summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-29 23:03:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-29 23:03:58 +0000
commit57000c38fc80c9d292e729186342253f32ee88da (patch)
tree0c6653ab76fef03c832fc1a4d6a48e6e10467f03 /compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp
parent2b14712ecadb68da8db0449d0017e9376aa5bca6 (diff)
downloadbcm5719-llvm-57000c38fc80c9d292e729186342253f32ee88da.tar.gz
bcm5719-llvm-57000c38fc80c9d292e729186342253f32ee88da.zip
ubsan: Disable __int128 tests if the host Clang does not support it. These
tests will still fail if compiler-rt was built with a compiler without __int128 support, but the host compiler has __int128 support. llvm-svn: 168955
Diffstat (limited to 'compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp')
-rw-r--r--compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp b/compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp
index b9c5d38c078..24b654a48fa 100644
--- a/compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp
+++ b/compiler-rt/lib/ubsan/lit_tests/Float/cast-overflow.cpp
@@ -14,6 +14,7 @@
// This test assumes float and double are IEEE-754 single- and double-precision.
#include <stdint.h>
+#include <stdio.h>
#include <string.h>
float Inf;
@@ -30,8 +31,10 @@ int main(int argc, char **argv) {
float MaxFloatRepresentableAsUInt = 0xffffff00u;
(unsigned int)MaxFloatRepresentableAsUInt; // ok
+#ifdef __SIZEOF_INT128__
unsigned __int128 FloatMaxAsUInt128 = -((unsigned __int128)1 << 104);
(void)(float)FloatMaxAsUInt128; // ok
+#endif
// Build a '+Inf'.
char InfVal[] = { 0x00, 0x00, 0x80, 0x7f };
@@ -71,8 +74,13 @@ int main(int argc, char **argv) {
// Integer -> floating point overflow.
case '6':
- // CHECK-6: fatal error: value 0xffffff00000000000000000000000001 is outside the range of representable values of type 'float'
+ // CHECK-6: {{fatal error: value 0xffffff00000000000000000000000001 is outside the range of representable values of type 'float'|__int128 not supported}}
+#ifdef __SIZEOF_INT128__
return (float)(FloatMaxAsUInt128 + 1);
+#else
+ puts("__int128 not supported");
+ return 0;
+#endif
// FIXME: The backend cannot lower __fp16 operations on x86 yet.
//case '7':
// (__fp16)65504; // ok
OpenPOWER on IntegriCloud