Introduce CRT_HAS_128BIT, currently for all __LP64__ platforms.
Use it to enable the various functions for TI mode.
llvm-svn: 201909
diff --git a/compiler-rt/lib/builtins/absvti2.c b/compiler-rt/lib/builtins/absvti2.c
index c1c7277..437bc3d 100644
--- a/compiler-rt/lib/builtins/absvti2.c
+++ b/compiler-rt/lib/builtins/absvti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: absolute value */
@@ -30,4 +30,5 @@
return (a ^ s) - s;
}
-#endif
+#endif /* CRT_HAS_128BIT */
+
diff --git a/compiler-rt/lib/builtins/addvti3.c b/compiler-rt/lib/builtins/addvti3.c
index 2efcf3b..f2a5c56 100644
--- a/compiler-rt/lib/builtins/addvti3.c
+++ b/compiler-rt/lib/builtins/addvti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a + b */
@@ -37,4 +37,4 @@
return s;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/ashlti3.c b/compiler-rt/lib/builtins/ashlti3.c
index 4bd8219..08d2181 100644
--- a/compiler-rt/lib/builtins/ashlti3.c
+++ b/compiler-rt/lib/builtins/ashlti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a << b */
@@ -42,4 +42,4 @@
return result.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/ashrti3.c b/compiler-rt/lib/builtins/ashrti3.c
index ed43641..6161bd5 100644
--- a/compiler-rt/lib/builtins/ashrti3.c
+++ b/compiler-rt/lib/builtins/ashrti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: arithmetic a >> b */
@@ -43,4 +43,4 @@
return result.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/clzti2.c b/compiler-rt/lib/builtins/clzti2.c
index 355c20e..d478db8 100644
--- a/compiler-rt/lib/builtins/clzti2.c
+++ b/compiler-rt/lib/builtins/clzti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: the number of leading 0-bits */
@@ -30,4 +30,4 @@
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/cmpti2.c b/compiler-rt/lib/builtins/cmpti2.c
index d0aec45..d287fab 100644
--- a/compiler-rt/lib/builtins/cmpti2.c
+++ b/compiler-rt/lib/builtins/cmpti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: if (a < b) returns 0
* if (a == b) returns 1
@@ -39,4 +39,4 @@
return 1;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/ctzti2.c b/compiler-rt/lib/builtins/ctzti2.c
index 66dc01b..43a8797 100644
--- a/compiler-rt/lib/builtins/ctzti2.c
+++ b/compiler-rt/lib/builtins/ctzti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: the number of trailing 0-bits */
@@ -30,4 +30,4 @@
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/divti3.c b/compiler-rt/lib/builtins/divti3.c
index 0242c13..ad365ab 100644
--- a/compiler-rt/lib/builtins/divti3.c
+++ b/compiler-rt/lib/builtins/divti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@@ -32,4 +32,4 @@
return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/ffsti2.c b/compiler-rt/lib/builtins/ffsti2.c
index 27e15d5..e64266d 100644
--- a/compiler-rt/lib/builtins/ffsti2.c
+++ b/compiler-rt/lib/builtins/ffsti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: the index of the least significant 1-bit in a, or
* the value zero if a is zero. The least significant bit is index one.
@@ -34,4 +34,4 @@
return __builtin_ctzll(x.s.low) + 1;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixdfti.c b/compiler-rt/lib/builtins/fixdfti.c
index b110a94..3b9ddb2 100644
--- a/compiler-rt/lib/builtins/fixdfti.c
+++ b/compiler-rt/lib/builtins/fixdfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@@ -42,4 +42,4 @@
return (r ^ s) - s;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixsfti.c b/compiler-rt/lib/builtins/fixsfti.c
index c730ae0..31c2702 100644
--- a/compiler-rt/lib/builtins/fixsfti.c
+++ b/compiler-rt/lib/builtins/fixsfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@@ -42,4 +42,4 @@
return (r ^ s) - s;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixunsdfti.c b/compiler-rt/lib/builtins/fixunsdfti.c
index fb0336f..76c8592 100644
--- a/compiler-rt/lib/builtins/fixunsdfti.c
+++ b/compiler-rt/lib/builtins/fixunsdfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@@ -44,4 +44,4 @@
return r;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixunssfti.c b/compiler-rt/lib/builtins/fixunssfti.c
index 8f4c626..2bb18af 100644
--- a/compiler-rt/lib/builtins/fixunssfti.c
+++ b/compiler-rt/lib/builtins/fixunssfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@@ -44,4 +44,4 @@
return r;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixunsxfti.c b/compiler-rt/lib/builtins/fixunsxfti.c
index 260bfc0..db3c070 100644
--- a/compiler-rt/lib/builtins/fixunsxfti.c
+++ b/compiler-rt/lib/builtins/fixunsxfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a unsigned long long, rounding toward zero.
* Negative values all become zero.
@@ -46,4 +46,4 @@
return r;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/fixxfti.c b/compiler-rt/lib/builtins/fixxfti.c
index 973dc31..ca3082e 100644
--- a/compiler-rt/lib/builtins/fixxfti.c
+++ b/compiler-rt/lib/builtins/fixxfti.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a signed long long, rounding toward zero. */
@@ -44,4 +44,4 @@
return (r ^ s) - s;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floattidf.c b/compiler-rt/lib/builtins/floattidf.c
index 77749f8..042c203 100644
--- a/compiler-rt/lib/builtins/floattidf.c
+++ b/compiler-rt/lib/builtins/floattidf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a double, rounding toward even.*/
@@ -82,4 +82,4 @@
return fb.f;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floattisf.c b/compiler-rt/lib/builtins/floattisf.c
index 4776125..cb4e29a 100644
--- a/compiler-rt/lib/builtins/floattisf.c
+++ b/compiler-rt/lib/builtins/floattisf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a float, rounding toward even. */
@@ -81,4 +81,4 @@
return fb.f;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floattixf.c b/compiler-rt/lib/builtins/floattixf.c
index 3813dc6..866051e 100644
--- a/compiler-rt/lib/builtins/floattixf.c
+++ b/compiler-rt/lib/builtins/floattixf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a long double, rounding toward even. */
@@ -47,7 +47,7 @@
* P = bit LDBL_MANT_DIG-1 bits to the right of 1
* Q = bit LDBL_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q
- */
+ */
switch (sd)
{
case LDBL_MANT_DIG + 1:
@@ -83,4 +83,4 @@
return fb.f;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floatuntidf.c b/compiler-rt/lib/builtins/floatuntidf.c
index 4c1d328..e7d6416 100644
--- a/compiler-rt/lib/builtins/floatuntidf.c
+++ b/compiler-rt/lib/builtins/floatuntidf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a double, rounding toward even. */
@@ -43,7 +43,7 @@
* P = bit DBL_MANT_DIG-1 bits to the right of 1
* Q = bit DBL_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q
- */
+ */
switch (sd)
{
case DBL_MANT_DIG + 1:
@@ -79,4 +79,4 @@
return fb.f;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floatuntisf.c b/compiler-rt/lib/builtins/floatuntisf.c
index c8da260..e65db57 100644
--- a/compiler-rt/lib/builtins/floatuntisf.c
+++ b/compiler-rt/lib/builtins/floatuntisf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a float, rounding toward even. */
@@ -78,4 +78,4 @@
return fb.f;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/floatuntixf.c b/compiler-rt/lib/builtins/floatuntixf.c
index dbce80f..d607cc3 100644
--- a/compiler-rt/lib/builtins/floatuntixf.c
+++ b/compiler-rt/lib/builtins/floatuntixf.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: convert a to a long double, rounding toward even. */
diff --git a/compiler-rt/lib/builtins/int_types.h b/compiler-rt/lib/builtins/int_types.h
index fcce390..5107f715 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -56,8 +56,11 @@
}s;
} udwords;
-#if __x86_64
+#if __LP64__
+#define CRT_HAS_128BIT
+#endif
+#ifdef CRT_HAS_128BIT
typedef int ti_int __attribute__ ((mode (TI)));
typedef unsigned tu_int __attribute__ ((mode (TI)));
@@ -105,7 +108,7 @@
return r.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
typedef union
{
diff --git a/compiler-rt/lib/builtins/lshrti3.c b/compiler-rt/lib/builtins/lshrti3.c
index be76814..6fc4e1f 100644
--- a/compiler-rt/lib/builtins/lshrti3.c
+++ b/compiler-rt/lib/builtins/lshrti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: logical a >> b */
@@ -42,4 +42,4 @@
return result.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/modti3.c b/compiler-rt/lib/builtins/modti3.c
index 752202d..ded24a0 100644
--- a/compiler-rt/lib/builtins/modti3.c
+++ b/compiler-rt/lib/builtins/modti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@@ -33,4 +33,4 @@
return (r ^ s) - s; /* negate if s == -1 */
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/muloti4.c b/compiler-rt/lib/builtins/muloti4.c
index f58dd07..0aa6f3b 100644
--- a/compiler-rt/lib/builtins/muloti4.c
+++ b/compiler-rt/lib/builtins/muloti4.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@@ -59,4 +59,4 @@
return result;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/multi3.c b/compiler-rt/lib/builtins/multi3.c
index 0b8730f..85a6cf4 100644
--- a/compiler-rt/lib/builtins/multi3.c
+++ b/compiler-rt/lib/builtins/multi3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@@ -55,4 +55,4 @@
return r.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/mulvti3.c b/compiler-rt/lib/builtins/mulvti3.c
index 31f7d2f..11d239a 100644
--- a/compiler-rt/lib/builtins/mulvti3.c
+++ b/compiler-rt/lib/builtins/mulvti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a * b */
@@ -57,4 +57,4 @@
return a * b;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/negti2.c b/compiler-rt/lib/builtins/negti2.c
index f7e4ad3..28ef941 100644
--- a/compiler-rt/lib/builtins/negti2.c
+++ b/compiler-rt/lib/builtins/negti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: -a */
@@ -27,4 +27,4 @@
return -a;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/negvti2.c b/compiler-rt/lib/builtins/negvti2.c
index 05df615..d15167f 100644
--- a/compiler-rt/lib/builtins/negvti2.c
+++ b/compiler-rt/lib/builtins/negvti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: -a */
@@ -29,4 +29,4 @@
return -a;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/parityti2.c b/compiler-rt/lib/builtins/parityti2.c
index a1f47b1..fa28380 100644
--- a/compiler-rt/lib/builtins/parityti2.c
+++ b/compiler-rt/lib/builtins/parityti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: 1 if number of bits is odd else returns 0 */
@@ -28,4 +28,4 @@
return __paritydi2(x.s.high ^ x.s.low);
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/popcountti2.c b/compiler-rt/lib/builtins/popcountti2.c
index 9566673..d7223d9 100644
--- a/compiler-rt/lib/builtins/popcountti2.c
+++ b/compiler-rt/lib/builtins/popcountti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: count of 1 bits */
@@ -41,4 +41,4 @@
return (x + (x >> 8)) & 0xFF; /* (8 significant bits) */
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/subvti3.c b/compiler-rt/lib/builtins/subvti3.c
index b32df5e..20a0814 100644
--- a/compiler-rt/lib/builtins/subvti3.c
+++ b/compiler-rt/lib/builtins/subvti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: a - b */
@@ -37,4 +37,4 @@
return s;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/ucmpti2.c b/compiler-rt/lib/builtins/ucmpti2.c
index 5466d21..95d1ff8 100644
--- a/compiler-rt/lib/builtins/ucmpti2.c
+++ b/compiler-rt/lib/builtins/ucmpti2.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Returns: if (a < b) returns 0
* if (a == b) returns 1
@@ -39,4 +39,4 @@
return 1;
}
-#endif
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/udivmodti4.c b/compiler-rt/lib/builtins/udivmodti4.c
index f619c74..d8cea2a 100644
--- a/compiler-rt/lib/builtins/udivmodti4.c
+++ b/compiler-rt/lib/builtins/udivmodti4.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
/* Effects: if rem != 0, *rem = a % b
* Returns: a / b
@@ -253,4 +253,4 @@
return q.all;
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/udivti3.c b/compiler-rt/lib/builtins/udivti3.c
index d9e1bb4..4a942b8 100644
--- a/compiler-rt/lib/builtins/udivti3.c
+++ b/compiler-rt/lib/builtins/udivti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@@ -26,4 +26,4 @@
return __udivmodti4(a, b, 0);
}
-#endif /* __x86_64 */
+#endif /* CRT_HAS_128BIT */
diff --git a/compiler-rt/lib/builtins/umodti3.c b/compiler-rt/lib/builtins/umodti3.c
index 8ebe7f0..2ab4dd2 100644
--- a/compiler-rt/lib/builtins/umodti3.c
+++ b/compiler-rt/lib/builtins/umodti3.c
@@ -14,7 +14,7 @@
#include "int_lib.h"
-#if __x86_64
+#ifdef CRT_HAS_128BIT
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
@@ -28,4 +28,4 @@
return r;
}
-#endif
+#endif /* CRT_HAS_128BIT */