diff mbox series

[09/10] arch: use arch_target for INT128's predefine

Message ID 20191216223756.2428-10-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series move arch specificities in their own files | expand

Commit Message

Luc Van Oostenryck Dec. 16, 2019, 10:37 p.m. UTC
The predefine for INT128 is still done with the generic
predefines but are arch-specific.

So, set a new flag for each arch supporting int128
and use this to determine if the predefine must be
issued or not.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 lib.c          | 10 +---------
 target-arm64.c |  1 +
 target-mips.c  |  1 +
 target-ppc.c   |  1 +
 target-riscv.c |  1 +
 target-s390.c  |  1 +
 target-sparc.c |  1 +
 target-x86.c   |  1 +
 target.h       |  1 +
 9 files changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/lib.c b/lib.c
index de9c87c180cb..842423c63d25 100644
--- a/lib.c
+++ b/lib.c
@@ -1350,16 +1350,8 @@  static void predefined_macros(void)
 	predefined_sizeof("DOUBLE", "", bits_in_double);
 	predefined_sizeof("LONG_DOUBLE", "", bits_in_longdouble);
 
-	switch (arch_mach) {
-	case MACH_ARM64:
-	case MACH_MIPS64:
-	case MACH_PPC64:
-	case MACH_RISCV64:
-	case MACH_S390X:
-	case MACH_SPARC64:
-	case MACH_X86_64:
+	if (arch_target->has_int128)
 		predefined_sizeof("INT128", "", 128);
-	}
 
 	predefine("__ORDER_LITTLE_ENDIAN__", 1, "1234");
 	predefine("__ORDER_BIG_ENDIAN__", 1, "4321");
diff --git a/target-arm64.c b/target-arm64.c
index 71db639cdf85..d491b65e5154 100644
--- a/target-arm64.c
+++ b/target-arm64.c
@@ -30,6 +30,7 @@  const struct target target_arm64 = {
 
 	.big_endian = 0,
 	.unsigned_char = 1,
+	.has_int128 = 1,
 
 	.wchar = &uint_ctype,
 
diff --git a/target-mips.c b/target-mips.c
index 395e6ff13567..3d73236feffd 100644
--- a/target-mips.c
+++ b/target-mips.c
@@ -45,6 +45,7 @@  const struct target target_mips64 = {
 	.bitness = ARCH_LP64,
 	.big_endian = 1,
 	.unsigned_char = 0,
+	.has_int128 = 1,
 
 	.target_32bit = &target_mips32,
 
diff --git a/target-ppc.c b/target-ppc.c
index 21ce86d813a4..b138635b9103 100644
--- a/target-ppc.c
+++ b/target-ppc.c
@@ -50,6 +50,7 @@  const struct target target_ppc64 = {
 	.bitness = ARCH_LP64,
 	.big_endian = 1,
 	.unsigned_char = 1,
+	.has_int128 = 1,
 
 	.target_32bit = &target_ppc32,
 
diff --git a/target-riscv.c b/target-riscv.c
index bbb47e9d7a34..08d036ca04b7 100644
--- a/target-riscv.c
+++ b/target-riscv.c
@@ -44,6 +44,7 @@  const struct target target_riscv64 = {
 	.bitness = ARCH_LP64,
 	.big_endian = 0,
 	.unsigned_char = 1,
+	.has_int128 = 1,
 
 	.target_32bit = &target_riscv32,
 
diff --git a/target-s390.c b/target-s390.c
index 159a6b1149b9..8fe7d93677b2 100644
--- a/target-s390.c
+++ b/target-s390.c
@@ -37,6 +37,7 @@  const struct target target_s390x = {
 	.bitness = ARCH_LP64,
 	.big_endian = 1,
 	.unsigned_char = 1,
+	.has_int128 = 1,
 
 	.bits_in_longdouble = 64,
 	.max_fp_alignment = 8,
diff --git a/target-sparc.c b/target-sparc.c
index 5267430f8bfd..70c440c2facf 100644
--- a/target-sparc.c
+++ b/target-sparc.c
@@ -58,6 +58,7 @@  const struct target target_sparc64 = {
 	.bitness = ARCH_LP64,
 	.big_endian = 1,
 	.unsigned_char = 0,
+	.has_int128 = 1,
 
 	.target_32bit = &target_sparc32,
 
diff --git a/target-x86.c b/target-x86.c
index 046e346e3b19..01d213ef46c2 100644
--- a/target-x86.c
+++ b/target-x86.c
@@ -61,6 +61,7 @@  const struct target target_x86_64 = {
 	.bitness = ARCH_LP64,
 	.big_endian = 0,
 	.unsigned_char = 0,
+	.has_int128 = 1,
 
 	.bits_in_longdouble = 128,
 	.max_fp_alignment = 16,
diff --git a/target.h b/target.h
index 8f39abb8d875..a89e21b63563 100644
--- a/target.h
+++ b/target.h
@@ -60,6 +60,7 @@  struct target {
 	unsigned int	big_endian:1;
 	unsigned int	unsigned_char:1;
 	unsigned int	size_t_long:1;
+	unsigned int	has_int128:1;
 
 	struct symbol	*wchar;
 	struct symbol	*wint;