aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2014-09-27 11:01:22 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2014-09-27 11:10:49 -0700
commitbaa8d8be1f1a3d83caf248533fda9abaa3b0ee70 (patch)
tree6fb99977824fefff067f34d7915fcefbc72e6043 /riscv/insns
parenteb27fce99c6f711a890c8647edaf077ec8d137d3 (diff)
downloadspike-baa8d8be1f1a3d83caf248533fda9abaa3b0ee70.zip
spike-baa8d8be1f1a3d83caf248533fda9abaa3b0ee70.tar.gz
spike-baa8d8be1f1a3d83caf248533fda9abaa3b0ee70.tar.bz2
Avoid use of __int128_t
It is nonstandard, and GCC doesn't support it on 32-bit platforms. The resulting code for MULH[[S]U] is crappier, but that doesn't really matter, as these instructions are dynamically infrequent.
Diffstat (limited to 'riscv/insns')
-rw-r--r--riscv/insns/mulh.h8
-rw-r--r--riscv/insns/mulhsu.h8
-rw-r--r--riscv/insns/mulhu.h4
3 files changed, 6 insertions, 14 deletions
diff --git a/riscv/insns/mulh.h b/riscv/insns/mulh.h
index f63869d..8ae7520 100644
--- a/riscv/insns/mulh.h
+++ b/riscv/insns/mulh.h
@@ -1,8 +1,4 @@
-if(xpr64)
-{
- int64_t a = RS1;
- int64_t b = RS2;
- WRITE_RD((int128_t(a) * int128_t(b)) >> 64);
-}
+if (xpr64)
+ WRITE_RD(mulh(RS1, RS2));
else
WRITE_RD(sext32((sext32(RS1) * sext32(RS2)) >> 32));
diff --git a/riscv/insns/mulhsu.h b/riscv/insns/mulhsu.h
index d62256e..3168ade 100644
--- a/riscv/insns/mulhsu.h
+++ b/riscv/insns/mulhsu.h
@@ -1,8 +1,4 @@
-if(xpr64)
-{
- int64_t a = RS1;
- uint64_t b = RS2;
- WRITE_RD((int128_t(a) * uint128_t(b)) >> 64);
-}
+if (xpr64)
+ WRITE_RD(mulhsu(RS1, RS2));
else
WRITE_RD(sext32((sext32(RS1) * reg_t((uint32_t)RS2)) >> 32));
diff --git a/riscv/insns/mulhu.h b/riscv/insns/mulhu.h
index 2d6f48c..b03b870 100644
--- a/riscv/insns/mulhu.h
+++ b/riscv/insns/mulhu.h
@@ -1,4 +1,4 @@
-if(xpr64)
- WRITE_RD((uint128_t(RS1) * uint128_t(RS2)) >> 64);
+if (xpr64)
+ WRITE_RD(mulhu(RS1, RS2));
else
WRITE_RD(sext32(((uint64_t)(uint32_t)RS1 * (uint64_t)(uint32_t)RS2) >> 32));