From patchwork Mon May 6 11:44:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 794987 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp880080wra; Mon, 6 May 2024 04:47:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrrddJIsZ7fnSE79d9+rGOOd13TAdocttzyU8VetHyuHtsCSb3nlopC5zGmlTFlZKROIqoc3pu/UgSLDu5DCuN X-Google-Smtp-Source: AGHT+IGaNVuia0WgIWBs/UEVT7nNIpsnGQse33aGLAehQoJQw0rPF2tX75yOPbhdMgXfKvZjYscx X-Received: by 2002:a9d:3e46:0:b0:6f0:2dd3:1d02 with SMTP id h6-20020a9d3e46000000b006f02dd31d02mr5375995otg.20.1714996056269; Mon, 06 May 2024 04:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714996056; cv=none; d=google.com; s=arc-20160816; b=LRN03kMaxjrf28kwQ/4ML/3o3jFCtdZUVv4AN6CcWLVWuw7dUVUCW20hIv3UyHA+FJ y2mwkTztZt0sXUnIyQPo0DthV23BZmg1vnGYikH1PRT4RKW7AVxTUO9j4NIp+tgS1VJP HT+/5OAMojZDQt/Ce+2md+IYe2ARIxYpflWOESQWWKgdK1DZ8AUJdZdXQRQvon6NLFje CnHbmhir9AbdQTkJpMxTQeo/JPbl0CAjM7zVmWuCcRz7ggaLm2uUiBHC7dFaKjgewHm+ 1XZXjaVDV0DH7j+nRwFrbmIren0BS8PvIPt5393iqmRyNgCOymAk41C+OWQHhyT5JaX3 IqeA== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Y5M4mmYouEfYYTQYVwtEst5GlagcgUaUVsX9+atwWag=; fh=n+s/UmlNdAcpkwZHkfPfDfNjQ/P7HHEaFIgb3Ls+s2Y=; b=EgtuS3SdKyXJz3CKjsb3AypU1FBFOzgAWdDZnv4O/poDE3rcyJXM4Fx8WZC8yjvZDp yoa0RNMmvQX/B6EUBjm3jwlj7u38Z6t54uI30EtRAuQrVM7lPptRVizoov576Z9JHAw+ n/wp9BgKeiI2jFHhbtyqVu2taLep27gRzWx6BPyNLrTJcSyitumiSejhYbXLnzKEhGUa I9rzgFyeWw8dxxxillxtn3WLcqW9wP4R5LzJzXcjcDhDc0YddatGX0wfdiLWrdarMB3h YVbefpc+a1zYKBqyQ012RB0cAJ39Pa5Cp4aywS2ILPtSn8VqJmiSWVceuJPoJlEZPnTD D6gQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ilande.co.uk header.s=20220518 header.b=1iwXMLli; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wi11-20020a05620a570b00b00790c8b4b8a8si8567522qkn.119.2024.05.06.04.47.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2024 04:47:36 -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=fail header.i=@ilande.co.uk header.s=20220518 header.b=1iwXMLli; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ilande.co.uk Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3woT-0003eq-SV; Mon, 06 May 2024 07:47:25 -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 1s3wms-0002Hv-6M for qemu-devel@nongnu.org; Mon, 06 May 2024 07:45:44 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3wmn-00024u-8v for qemu-devel@nongnu.org; Mon, 06 May 2024 07:45:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Y5M4mmYouEfYYTQYVwtEst5GlagcgUaUVsX9+atwWag=; b=1iwXMLliFz1iZ7jZX7STosT1/h H8rWdYsYmUaBxDyuR+i5VTzQMzG9A+HalnfRiUZrFd1ftcb9doeb1Vg0l5ddAA/5LSFbBpep6SFgD UOZB7Hm2Qwn2Ht8oeCTnV5SR22wApFRqXfOsK4blCsFFYQYWDh2TBNt7KTt9YzUur1lCdAEFzT8YL P0Sdzq0WtltPorQFRMjjdgkabpm2O8mGQDezoDzZosM6OZxF9+L3iBvUHrtPdOr2j8uAunaRFSN3J ornR2Z0qcp5/RtwPgxb4MNfb7yoOco1jWyc5U22tL58XIAMnVQvnQd6LcXNgTK0W8zHV9/fnaaDPw WufwGBGBY221Dq+siYxVuh+LNJJ+HJSQXknBSIVEqeSkTURfpkoPWldGP07pcm2TOHBPH9LeUA9Vj vJYMYUfvBONt+zzkpaSS0uZlv7IotuphSG6n3TruhjZUoV2qiHUfqGfPJ4AWo6N4YsWtdJaM66xAJ 0SR6XiwWde3mmJTjfR96M8OIWasufILf9uEnXotANwJDK41lsG1LBWzai+B7kjb8JsEDsSVeYSkY1 WxBVSrZcUf71f8FgJOuChkBN4fuMW8PUniJs1qLJ9O4bLzRIjL3J4LZvgrexL8d1oacT+lg2jMIRl mjVjauCcdWuK+nkg4beOp7XHhmKGE1y7OJMOOFWqw=; Received: from [2a00:23c4:8bb4:4000:b60d:a162:d698:c802] (helo=localhost.localdomain) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s3wle-0005pA-RQ; Mon, 06 May 2024 12:44:30 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, richard.henderson@linaro.org Date: Mon, 6 May 2024 12:44:47 +0100 Message-Id: <20240506114451.331311-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240506114451.331311-1-mark.cave-ayland@ilande.co.uk> References: <20240506114451.331311-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a00:23c4:8bb4:4000:b60d:a162:d698:c802 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PULL 08/12] target/sparc: Fix FMUL8x16 X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk 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, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 From: Richard Henderson This instruction has f32 as source1, which alters the decoding of the register number, which means we've been passing the wrong data for odd register numbers. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240502165528.244004-4-richard.henderson@linaro.org> Signed-off-by: Mark Cave-Ayland --- target/sparc/helper.h | 2 +- target/sparc/translate.c | 21 ++++++++++++++++++++- target/sparc/vis_helper.c | 9 +++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index 57ab755ffd..27dc604cac 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -95,7 +95,7 @@ DEF_HELPER_FLAGS_2(fdtox, TCG_CALL_NO_WG, s64, env, f64) DEF_HELPER_FLAGS_2(fqtox, TCG_CALL_NO_WG, s64, env, i128) DEF_HELPER_FLAGS_2(fpmerge, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_2(fmul8x16, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_2(fmul8x16, TCG_CALL_NO_RWG_SE, i64, i32, i64) DEF_HELPER_FLAGS_2(fmul8x16al, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmul8x16au, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmul8sux16, TCG_CALL_NO_RWG_SE, i64, i64, i64) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index dfcfe855a1..c4adc148d2 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4583,6 +4583,26 @@ TRANS(FSUBs, ALL, do_env_fff, a, gen_helper_fsubs) TRANS(FMULs, ALL, do_env_fff, a, gen_helper_fmuls) TRANS(FDIVs, ALL, do_env_fff, a, gen_helper_fdivs) +static bool do_dfd(DisasContext *dc, arg_r_r_r *a, + void (*func)(TCGv_i64, TCGv_i32, TCGv_i64)) +{ + TCGv_i64 dst, src2; + TCGv_i32 src1; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = gen_dest_fpr_D(dc, a->rd); + src1 = gen_load_fpr_F(dc, a->rs1); + src2 = gen_load_fpr_D(dc, a->rs2); + func(dst, src1, src2); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FMUL8x16, VIS1, do_dfd, a, gen_helper_fmul8x16) + static bool do_ddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -4600,7 +4620,6 @@ static bool do_ddd(DisasContext *dc, arg_r_r_r *a, return advance_pc(dc); } -TRANS(FMUL8x16, VIS1, do_ddd, a, gen_helper_fmul8x16) TRANS(FMUL8x16AU, VIS1, do_ddd, a, gen_helper_fmul8x16au) TRANS(FMUL8x16AL, VIS1, do_ddd, a, gen_helper_fmul8x16al) TRANS(FMUL8SUx16, VIS1, do_ddd, a, gen_helper_fmul8sux16) diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c index db2e6dd6c1..7728ffe9c6 100644 --- a/target/sparc/vis_helper.c +++ b/target/sparc/vis_helper.c @@ -94,16 +94,17 @@ uint64_t helper_fpmerge(uint64_t src1, uint64_t src2) return d.ll; } -uint64_t helper_fmul8x16(uint64_t src1, uint64_t src2) +uint64_t helper_fmul8x16(uint32_t src1, uint64_t src2) { - VIS64 s, d; + VIS64 d; + VIS32 s; uint32_t tmp; - s.ll = src1; + s.l = src1; d.ll = src2; #define PMUL(r) \ - tmp = (int32_t)d.VIS_SW64(r) * (int32_t)s.VIS_B64(r); \ + tmp = (int32_t)d.VIS_SW64(r) * (int32_t)s.VIS_B32(r); \ if ((tmp & 0xff) > 0x7f) { \ tmp += 0x100; \ } \