public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: riscv: fix building on 32-bit hosts w/out int128
@ 2021-05-01 20:27 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2021-05-01 20:27 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd12755bf409cb931682a13f08e41d87fac84ab5

commit bd12755bf409cb931682a13f08e41d87fac84ab5
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat May 1 15:58:09 2021 -0400

    sim: riscv: fix building on 32-bit hosts w/out int128
    
    Check for __SIZEOF_INT128__ before trying to use the builtin type.
    This fixes building on some 32-bit systems like x86.

Diff:
---
 sim/riscv/ChangeLog  | 4 ++++
 sim/riscv/sim-main.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sim/riscv/ChangeLog b/sim/riscv/ChangeLog
index 37284a982a9..367faac9d4e 100644
--- a/sim/riscv/ChangeLog
+++ b/sim/riscv/ChangeLog
@@ -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.
diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index a80dc683826..6a2904cced7 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-01 20:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 20:27 [binutils-gdb] sim: riscv: fix building on 32-bit hosts w/out int128 Michael Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).