From patchwork Thu Sep 5 13:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 825656 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp288625wrb; Thu, 5 Sep 2024 06:06:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUM9VId2VzZRXy9AdxegSOttkiZyu76asNEuM1mSSaKJL9QfHKRuoAH0LWOFNGuHqkieBA5ZQ==@linaro.org X-Google-Smtp-Source: AGHT+IFY4DdKkTE6WLyVlA6kU0rJTQRT86pC/cjnlNkKfHgGMhvPYqIjND1eEv08uqCuwMmdeWvD X-Received: by 2002:a05:6830:2115:b0:703:6477:460a with SMTP id 46e09a7af769-70f7074603emr19085192a34.29.1725541574654; Thu, 05 Sep 2024 06:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725541574; cv=none; d=google.com; s=arc-20160816; b=iPxbbKJ0KhDP3B4/f/95C+6HgTOcIpZFx5CspT6k2MboJckouUpYAUg/6CKx6gNoQz MvHCS8mmV2F9ptQSmVxwEs5LmWK0VveoQlFSPyXeMCfvzaJFeSurWedp/RV9egqZUbPU pN955S2++9joqoF/BHIeEKPf5IosBzyQeI3ObbaEcv6N0zHMadXS8Gai4W9LfVowKm98 zRTE6SQfilBwv0lUlkPDSf6iHWqsE++R2Qd/hoiNktdg0dhDLfddXW3OfwsIj+j+7ckQ eok1bGLyO2gA3EDlV11L3cojF+yemyb/2/Oi3j/lOfDG2C3S5EIZrmammcAZODV1WIe1 OL7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qIUBV+3eAKQWSLQmZz1TCwCdei1m98hDG02Oo3r/Z6c=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=maIbwol07CW8RYjwiuD04vCvfE7SKwWpuhcRxZiKRW69sECcT9DAw8MaxGI0V/yvLc k60megV+lRe22YvIMY91xcZ5XWjBMXtDcxmWAcH2g09FZTeuLv089UyjGcGB4FcwIdaU k3chNvG65cOrOfU8GwEnR+AZ5B+P3Ub/bPv+MDyxzsWsEE5oAOpceBdqn5gLhF9lQAUK QeHDJcvh4z7aMMvU18fTb5KSRKLI7mklvdc5X5FUvAiVbLheiEFaZjcLOrib9tPjdTIK D/A6xH3ilEeM226OeiTQGRQ3bwR7IYSmnKfe/Bx/XiShRCEeHtAlLJ+1yqWf3w9AHHOW u8jg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EhHOiydU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-49bc9a10f5asi641355137.822.2024.09.05.06.06.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2024 06:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EhHOiydU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smC7D-00022o-Cn; Thu, 05 Sep 2024 09:01:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smC71-0001JO-H8 for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:23 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smC6x-0001ma-JM for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:23 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-42c2e50ec6aso4401315e9.0 for ; Thu, 05 Sep 2024 06:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725541277; x=1726146077; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qIUBV+3eAKQWSLQmZz1TCwCdei1m98hDG02Oo3r/Z6c=; b=EhHOiydUFE+/Yacszz33MQC0xjDKJAdHWYILuedm0C7o5gBbuevxgjKG6rEf+EezEx Zq+LRrwnhPta9DxV4um0U0aM/DPRdiqqpdjlJYr4uHaZBUuws44bgYCQW7IDXvTV5FFC gCCB+gNbPE1OY1P5BLJQofxGAIw165Dza8/k8cXIqMy96ZX6QWyl98vVLCGzp4PJzHGm uCF6lY5kVCfWLuQ1XshQYIF73gqDqK9QC3/3OW+f0JAwntTydgriNRY4qqUVtxWvHQnn gTiW4opKARfOYU1zXpxEWi2Myqh7OM1yHJBa67373EYY04MI4fNT9XPMv0mNfPyBfXYd KLZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541277; x=1726146077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qIUBV+3eAKQWSLQmZz1TCwCdei1m98hDG02Oo3r/Z6c=; b=ur3q7vUcTXEgAOhb/Q3LdY0TdzCAv8apy9EzewsSIHI4dIvlSoEaughXPtYY2qBM8n hA+MlZcJFrq1/79i3wcupJ/3jrqXvhz6Pzr30/g6T8nHiS4OinTFefjF1kwT3MsyrAAr TeD8VzUtTgPRHp3UBwrJnh4Zm0mrAp0qjAX+Tr1O6AuT/ObNVNUi5VqpiyG/EhcQQKpW Ps7aMiKXHSMYCx35vGx4lJXD2Se8Yzdg0xuYgOMpFQ2EvogOdS2PDGrYonrY8eIb+ICR TAHOTHccGAn82Wh1IiCrjhe1978qNrTT5ugV3YvciJ5PWZ41H+0p8IdrF9iNA6DviAFL dOpw== X-Gm-Message-State: AOJu0Yz8YutWi28QBcTbbAZYQZoxsVbD8vc6eAQXI+OIEMfEO1h1Qg/I MId5akKqvoHhbZ7wYOZlvLgzgbvf95+CptRRRVmY0OabHgymAeNrdLfn7IsELygBZe/2ikH7Eyy + X-Received: by 2002:a05:600c:3543:b0:426:5b19:d2b3 with SMTP id 5b1f17b1804b1-42c95bbe2ddmr35864475e9.14.1725541276912; Thu, 05 Sep 2024 06:01:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e355dfsm232251365e9.46.2024.09.05.06.01.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:01:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/25] target/arm: Correct names of VFP VFNMA and VFNMS insns Date: Thu, 5 Sep 2024 14:00:56 +0100 Message-Id: <20240905130100.298768-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905130100.298768-1-peter.maydell@linaro.org> References: <20240905130100.298768-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In vfp.decode we have the names of the VFNMA and VFNMS instructions the wrong way around. The architecture says that bit 6 is the 'op' bit, which is 1 for VFNMA and 0 for VFNMS, but we label these two lines of decode the other way around. This doesn't cause any user-visible problem because in the handling of these functions in translate-vfp.c we give VFNMA the behaviour specified for VFNMS and vice-versa, but it's confusing when reading the code. Switch the names of the VFP VFNMA and VFNMS instructions in the decode file and flip the behaviour also. NB: the instructions VFMA and VFMS *are* decoded with op=0 for VFMA and op=1 for VFMS; the confusion probably arose because we assumed VFNMA and VFNMS to be the same way around. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2536 Signed-off-by: Peter Maydell Message-id: 20240830152156.2046590-1-peter.maydell@linaro.org Reviewed-by: Richard Henderson --- target/arm/tcg/vfp.decode | 12 ++++++------ target/arm/tcg/translate-vfp.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/vfp.decode b/target/arm/tcg/vfp.decode index 5405e80197b..2dd87a27089 100644 --- a/target/arm/tcg/vfp.decode +++ b/target/arm/tcg/vfp.decode @@ -141,18 +141,18 @@ VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d VFMA_hp ---- 1110 1.10 .... .... 1001 .0. 0 .... @vfp_dnm_s VFMS_hp ---- 1110 1.10 .... .... 1001 .1. 0 .... @vfp_dnm_s -VFNMA_hp ---- 1110 1.01 .... .... 1001 .0. 0 .... @vfp_dnm_s -VFNMS_hp ---- 1110 1.01 .... .... 1001 .1. 0 .... @vfp_dnm_s +VFNMS_hp ---- 1110 1.01 .... .... 1001 .0. 0 .... @vfp_dnm_s +VFNMA_hp ---- 1110 1.01 .... .... 1001 .1. 0 .... @vfp_dnm_s VFMA_sp ---- 1110 1.10 .... .... 1010 .0. 0 .... @vfp_dnm_s VFMS_sp ---- 1110 1.10 .... .... 1010 .1. 0 .... @vfp_dnm_s -VFNMA_sp ---- 1110 1.01 .... .... 1010 .0. 0 .... @vfp_dnm_s -VFNMS_sp ---- 1110 1.01 .... .... 1010 .1. 0 .... @vfp_dnm_s +VFNMS_sp ---- 1110 1.01 .... .... 1010 .0. 0 .... @vfp_dnm_s +VFNMA_sp ---- 1110 1.01 .... .... 1010 .1. 0 .... @vfp_dnm_s VFMA_dp ---- 1110 1.10 .... .... 1011 .0.0 .... @vfp_dnm_d VFMS_dp ---- 1110 1.10 .... .... 1011 .1.0 .... @vfp_dnm_d -VFNMA_dp ---- 1110 1.01 .... .... 1011 .0.0 .... @vfp_dnm_d -VFNMS_dp ---- 1110 1.01 .... .... 1011 .1.0 .... @vfp_dnm_d +VFNMS_dp ---- 1110 1.01 .... .... 1011 .0.0 .... @vfp_dnm_d +VFNMA_dp ---- 1110 1.01 .... .... 1011 .1.0 .... @vfp_dnm_d VMOV_imm_hp ---- 1110 1.11 .... .... 1001 0000 .... \ vd=%vd_sp imm=%vmov_imm diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c index cd5b8483576..b6fa28a7bf6 100644 --- a/target/arm/tcg/translate-vfp.c +++ b/target/arm/tcg/translate-vfp.c @@ -2190,8 +2190,8 @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d) static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) { /* - * VFNMA : fd = muladd(-fd, fn, fm) - * VFNMS : fd = muladd(-fd, -fn, fm) + * VFNMA : fd = muladd(-fd, -fn, fm) + * VFNMS : fd = muladd(-fd, fn, fm) * VFMA : fd = muladd( fd, fn, fm) * VFMS : fd = muladd( fd, -fn, fm) * @@ -2262,8 +2262,8 @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d) #define MAKE_VFM_TRANS_FNS(PREC) \ MAKE_ONE_VFM_TRANS_FN(VFMA, PREC, false, false) \ MAKE_ONE_VFM_TRANS_FN(VFMS, PREC, true, false) \ - MAKE_ONE_VFM_TRANS_FN(VFNMA, PREC, false, true) \ - MAKE_ONE_VFM_TRANS_FN(VFNMS, PREC, true, true) + MAKE_ONE_VFM_TRANS_FN(VFNMS, PREC, false, true) \ + MAKE_ONE_VFM_TRANS_FN(VFNMA, PREC, true, true) MAKE_VFM_TRANS_FNS(hp) MAKE_VFM_TRANS_FNS(sp)