sim: riscv: fix building on 32-bit hosts w/out int128
authorMike Frysinger <vapier@gentoo.org>
Sat, 1 May 2021 19:58:09 +0000 (15:58 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 1 May 2021 20:26:31 +0000 (16:26 -0400)
Check for __SIZEOF_INT128__ before trying to use the builtin type.
This fixes building on some 32-bit systems like x86.

sim/riscv/ChangeLog
sim/riscv/sim-main.c

index 37284a982a9bb14b6b27057f924c02f5540b7266..367faac9d4ed77fbfc98ce6072114f153e86a4f7 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-01  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-main.c (mulhu): Check if __SIZEOF_INT128__ is defined.
+
 2021-04-26  Mike Frysinger  <vapier@gentoo.org>
 
        * sim-main.c (MAX, MIN): Delete.
index a80dc6838260db05f34bfa674f154122c08a5e4b..6a2904cced738b5a9c4b2c725330dda173b6ffde 100644 (file)
@@ -603,7 +603,7 @@ execute_i (SIM_CPU *cpu, unsigned_word iw, const struct riscv_opcode *op)
 static unsigned64
 mulhu (unsigned64 a, unsigned64 b)
 {
-#ifdef __GNUC__
+#if defined(__GNUC__) && defined(__SIZEOF_INT128__)
   return ((__int128)a * b) >> 64;
 #else
   uint64_t t;