summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2015-06-12 18:28:47 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2015-06-12 18:28:47 +0000
commit536b61e10717d15747ba3050c094db2ff6e79667 (patch)
treec480781440b26e69833f19c2bddd8d1715a92745
parent5c2fd24d4c819c96d678cc43c3cb9073bb2a6bd1 (diff)
downloadcompiler-rt-536b61e10717d15747ba3050c094db2ff6e79667.tar.gz
[builtins] Hide long double fp_test.h helpers if it's not fp128.
Like we do for the various __*tf* tests, check that long double is the 128bit type we expect directly in the header. The latter is now used by unrelated tests (__*hf* since r237161), and those tests will break for no reason if uint128_t doesn't exist, and long double isn't fp128. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@239630 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/builtins/Unit/fp_test.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/builtins/Unit/fp_test.h b/test/builtins/Unit/fp_test.h
index 95740b68c..79d652f17 100644
--- a/test/builtins/Unit/fp_test.h
+++ b/test/builtins/Unit/fp_test.h
@@ -38,6 +38,7 @@ static inline double fromRep64(uint64_t x)
return ret;
}
+#if __LDBL_MANT_DIG__ == 113
static inline long double fromRep128(uint64_t hi, uint64_t lo)
{
__uint128_t x = ((__uint128_t)hi << 64) + lo;
@@ -45,6 +46,7 @@ static inline long double fromRep128(uint64_t hi, uint64_t lo)
memcpy(&ret, &x, 16);
return ret;
}
+#endif
static inline uint16_t toRep16(uint16_t x)
{
@@ -65,12 +67,14 @@ static inline uint64_t toRep64(double x)
return ret;
}
+#if __LDBL_MANT_DIG__ == 113
static inline __uint128_t toRep128(long double x)
{
__uint128_t ret;
memcpy(&ret, &x, 16);
return ret;
}
+#endif
static inline int compareResultH(uint16_t result,
uint16_t expected)
@@ -126,6 +130,7 @@ static inline int compareResultD(double result,
return 1;
}
+#if __LDBL_MANT_DIG__ == 113
// return 0 if equal
// use two 64-bit integers intead of one 128-bit integer
// because 128-bit integer constant can't be assigned directly
@@ -149,6 +154,7 @@ static inline int compareResultLD(long double result,
}
return 1;
}
+#endif
static inline int compareResultCMP(int result,
enum EXPECTED_RESULT expected)
@@ -220,10 +226,12 @@ static inline double makeQNaN64()
return fromRep64(0x7ff8000000000000UL);
}
+#if __LDBL_MANT_DIG__ == 113
static inline long double makeQNaN128()
{
return fromRep128(0x7fff800000000000UL, 0x0UL);
}
+#endif
static inline uint16_t makeNaN16(uint16_t rand)
{
@@ -240,10 +248,12 @@ static inline double makeNaN64(uint64_t rand)
return fromRep64(0x7ff0000000000000UL | (rand & 0xfffffffffffffUL));
}
+#if __LDBL_MANT_DIG__ == 113
static inline long double makeNaN128(uint64_t rand)
{
return fromRep128(0x7fff000000000000UL | (rand & 0xffffffffffffUL), 0x0UL);
}
+#endif
static inline uint16_t makeInf16()
{
@@ -260,7 +270,9 @@ static inline double makeInf64()
return fromRep64(0x7ff0000000000000UL);
}
+#if __LDBL_MANT_DIG__ == 113
static inline long double makeInf128()
{
return fromRep128(0x7fff000000000000UL, 0x0UL);
}
+#endif