aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-08 16:11:42 -0600
committerRichard Henderson <richard.henderson@linaro.org>2024-12-24 08:32:15 -0800
commit65b4dce393cddb5fb0295bf6666f7db8512b8cff (patch)
tree250f2292e04382178fac10e40f00d47f80ce33f1
parent8429306c327e59786d96497bd6c36c42ccf58a06 (diff)
downloadqemu-65b4dce393cddb5fb0295bf6666f7db8512b8cff.zip
qemu-65b4dce393cddb5fb0295bf6666f7db8512b8cff.tar.gz
qemu-65b4dce393cddb5fb0295bf6666f7db8512b8cff.tar.bz2
target/hexagon: Use mulu64 for int128_mul_6464
No need to open-code 64x64->128-bit multiplication. Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--target/hexagon/fma_emu.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/target/hexagon/fma_emu.c b/target/hexagon/fma_emu.c
index ddc793f..07d2880 100644
--- a/target/hexagon/fma_emu.c
+++ b/target/hexagon/fma_emu.c
@@ -82,38 +82,12 @@ int32_t float32_getexp(float32 f32)
return -1;
}
-static uint32_t int128_getw0(Int128 x)
-{
- return int128_getlo(x);
-}
-
-static uint32_t int128_getw1(Int128 x)
-{
- return int128_getlo(x) >> 32;
-}
-
static Int128 int128_mul_6464(uint64_t ai, uint64_t bi)
{
- Int128 a, b;
- uint64_t pp0, pp1a, pp1b, pp1s, pp2;
-
- a = int128_make64(ai);
- b = int128_make64(bi);
- pp0 = (uint64_t)int128_getw0(a) * (uint64_t)int128_getw0(b);
- pp1a = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw0(b);
- pp1b = (uint64_t)int128_getw1(b) * (uint64_t)int128_getw0(a);
- pp2 = (uint64_t)int128_getw1(a) * (uint64_t)int128_getw1(b);
-
- pp1s = pp1a + pp1b;
- if ((pp1s < pp1a) || (pp1s < pp1b)) {
- pp2 += (1ULL << 32);
- }
- uint64_t ret_low = pp0 + (pp1s << 32);
- if ((ret_low < pp0) || (ret_low < (pp1s << 32))) {
- pp2 += 1;
- }
+ uint64_t l, h;
- return int128_make128(ret_low, pp2 + (pp1s >> 32));
+ mulu64(&l, &h, ai, bi);
+ return int128_make128(l, h);
}
static Int128 int128_sub_borrow(Int128 a, Int128 b, int borrow)