diff --git a/compiler-rt/test/Unit/fixunsxfdi_test.c b/compiler-rt/test/Unit/fixunsxfdi_test.c index c839a361a210..f8c8945117ae 100644 --- a/compiler-rt/test/Unit/fixunsxfdi_test.c +++ b/compiler-rt/test/Unit/fixunsxfdi_test.c @@ -11,11 +11,12 @@ // //===----------------------------------------------------------------------===// -#if !_ARCH_PPC - #include "int_lib.h" #include +#include + +#if HAS_80_BIT_LONG_DOUBLE // Returns: convert a to a unsigned long long, rounding toward zero. // Negative values all become zero. @@ -41,12 +42,11 @@ int test__fixunsxfdi(long double a, du_int expected) char assumption_1[sizeof(du_int) == 2*sizeof(su_int)] = {0}; char assumption_2[sizeof(du_int)*CHAR_BIT == 64] = {0}; char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; - #endif int main() { -#if !_ARCH_PPC +#if HAS_80_BIT_LONG_DOUBLE if (test__fixunsxfdi(0.0, 0)) return 1; diff --git a/compiler-rt/test/Unit/fixunsxfsi_test.c b/compiler-rt/test/Unit/fixunsxfsi_test.c index 2b516d5b6487..0353b6bf3cce 100644 --- a/compiler-rt/test/Unit/fixunsxfsi_test.c +++ b/compiler-rt/test/Unit/fixunsxfsi_test.c @@ -11,11 +11,10 @@ // //===----------------------------------------------------------------------===// -#if !_ARCH_PPC - #include "int_lib.h" #include +#if HAS_80_BIT_LONG_DOUBLE // Returns: convert a to a unsigned int, rounding toward zero. // Negative values all become zero. @@ -39,12 +38,11 @@ int test__fixunsxfsi(long double a, su_int expected) char assumption_2[sizeof(su_int)*CHAR_BIT == 32] = {0}; char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; - #endif int main() { -#if !_ARCH_PPC +#if HAS_80_BIT_LONG_DOUBLE if (test__fixunsxfsi(0.0, 0)) return 1; diff --git a/compiler-rt/test/Unit/fixxfdi_test.c b/compiler-rt/test/Unit/fixxfdi_test.c index 9fe4e0a7cee8..47820c35b5a7 100644 --- a/compiler-rt/test/Unit/fixxfdi_test.c +++ b/compiler-rt/test/Unit/fixxfdi_test.c @@ -11,11 +11,11 @@ // //===----------------------------------------------------------------------===// -#if !_ARCH_PPC - #include "int_lib.h" #include + +#if HAS_80_BIT_LONG_DOUBLE // Returns: convert a to a signed long long, rounding toward zero. // Assumption: long double is an intel 80 bit floating point type padded with 6 bytes @@ -39,12 +39,11 @@ int test__fixxfdi(long double a, di_int expected) char assumption_1[sizeof(di_int) == 2*sizeof(si_int)] = {0}; char assumption_2[sizeof(su_int)*CHAR_BIT == 32] = {0}; char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; - #endif int main() { -#if !_ARCH_PPC +#if HAS_80_BIT_LONG_DOUBLE if (test__fixxfdi(0.0, 0)) return 1; diff --git a/compiler-rt/test/Unit/floatdixf_test.c b/compiler-rt/test/Unit/floatdixf_test.c index cb3f5e0a3bf5..d96c7e8e41ce 100644 --- a/compiler-rt/test/Unit/floatdixf_test.c +++ b/compiler-rt/test/Unit/floatdixf_test.c @@ -11,11 +11,10 @@ // //===----------------------------------------------------------------------===// -#if !_ARCH_PPC - #include "int_lib.h" #include +#if HAS_80_BIT_LONG_DOUBLE // Returns: convert a to a long double, rounding toward even. // Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits @@ -38,12 +37,11 @@ int test__floatdixf(di_int a, long double expected) char assumption_1[sizeof(di_int) == 2*sizeof(si_int)] = {0}; char assumption_2[sizeof(di_int)*CHAR_BIT == 64] = {0}; char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; - #endif int main() { -#if !_ARCH_PPC +#if HAS_80_BIT_LONG_DOUBLE if (test__floatdixf(0, 0.0)) return 1; diff --git a/compiler-rt/test/Unit/floatundixf_test.c b/compiler-rt/test/Unit/floatundixf_test.c index 11263482764a..40e1d720efc7 100644 --- a/compiler-rt/test/Unit/floatundixf_test.c +++ b/compiler-rt/test/Unit/floatundixf_test.c @@ -11,11 +11,11 @@ // //===----------------------------------------------------------------------===// -#if !_ARCH_PPC - #include "int_lib.h" #include + +#if HAS_80_BIT_LONG_DOUBLE // Returns: convert a to a long double, rounding toward even. // Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits @@ -38,12 +38,11 @@ int test__floatundixf(du_int a, long double expected) char assumption_1[sizeof(du_int) == 2*sizeof(si_int)] = {0}; char assumption_2[sizeof(du_int)*CHAR_BIT == 64] = {0}; char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; - #endif int main() { -#if !_ARCH_PPC +#if HAS_80_BIT_LONG_DOUBLE if (test__floatundixf(0, 0.0)) return 1; diff --git a/compiler-rt/test/Unit/int_lib.h b/compiler-rt/test/Unit/int_lib.h index bc8c98e78de6..e5bfd6630019 100644 --- a/compiler-rt/test/Unit/int_lib.h +++ b/compiler-rt/test/Unit/int_lib.h @@ -149,4 +149,11 @@ typedef union long double f; } long_double_bits; + +/* for test cases that are only applicable to */ +/* architectures with 80-bit long doubles */ +#if __i386__ || __x86_64__ + #define HAS_80_BIT_LONG_DOUBLE 1 +#endif + #endif /* INT_LIB_H */