aboutsummaryrefslogtreecommitdiff
path: root/target/sparc/vis_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-05-02 09:55:25 -0700
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-05-05 21:02:48 +0100
commita859602c746baf4892cc8ca1ce003e92411d1716 (patch)
tree9128471570d1f1a49da081fc3760a002f56fe9bd /target/sparc/vis_helper.c
parent9157dccc7e71f7c94581c38f38acbef9a21bbe9a (diff)
downloadqemu-a859602c746baf4892cc8ca1ce003e92411d1716.zip
qemu-a859602c746baf4892cc8ca1ce003e92411d1716.tar.gz
qemu-a859602c746baf4892cc8ca1ce003e92411d1716.tar.bz2
target/sparc: Fix FMUL8x16A{U,L}
These instructions have f32 inputs, which changes the decode of the register numbers. While we're fixing things, use a common helper for both insns, extracting the 16-bit scalar in tcg beforehand. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240502165528.244004-5-richard.henderson@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'target/sparc/vis_helper.c')
-rw-r--r--target/sparc/vis_helper.c47
1 files changed, 13 insertions, 34 deletions
diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c
index 7728ffe..ff2f43c 100644
--- a/target/sparc/vis_helper.c
+++ b/target/sparc/vis_helper.c
@@ -119,44 +119,23 @@ uint64_t helper_fmul8x16(uint32_t src1, uint64_t src2)
return d.ll;
}
-uint64_t helper_fmul8x16al(uint64_t src1, uint64_t src2)
+uint64_t helper_fmul8x16a(uint32_t src1, int32_t src2)
{
- VIS64 s, d;
- uint32_t tmp;
-
- s.ll = src1;
- d.ll = src2;
-
-#define PMUL(r) \
- tmp = (int32_t)d.VIS_SW64(1) * (int32_t)s.VIS_B64(r); \
- if ((tmp & 0xff) > 0x7f) { \
- tmp += 0x100; \
- } \
- d.VIS_W64(r) = tmp >> 8;
-
- PMUL(0);
- PMUL(1);
- PMUL(2);
- PMUL(3);
-#undef PMUL
-
- return d.ll;
-}
-
-uint64_t helper_fmul8x16au(uint64_t src1, uint64_t src2)
-{
- VIS64 s, d;
+ VIS32 s;
+ VIS64 d;
uint32_t tmp;
- s.ll = src1;
- d.ll = src2;
+ s.l = src1;
+ d.ll = 0;
-#define PMUL(r) \
- tmp = (int32_t)d.VIS_SW64(0) * (int32_t)s.VIS_B64(r); \
- if ((tmp & 0xff) > 0x7f) { \
- tmp += 0x100; \
- } \
- d.VIS_W64(r) = tmp >> 8;
+#define PMUL(r) \
+ do { \
+ tmp = src2 * (int32_t)s.VIS_B32(r); \
+ if ((tmp & 0xff) > 0x7f) { \
+ tmp += 0x100; \
+ } \
+ d.VIS_W64(r) = tmp >> 8; \
+ } while (0)
PMUL(0);
PMUL(1);