Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / builtins / Unit / fixsfsivfp_test.c
blob63666c7cb2587af2429818f47467e5f4c233f1d2
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixsfsivfp
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <math.h>
9 extern int __fixsfsivfp(float a);
11 #if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x4)
12 int test__fixsfsivfp(float a)
14 int actual = __fixsfsivfp(a);
15 int expected = a;
16 if (actual != expected)
17 printf("error in test__fixsfsivfp(%f) = %u, expected %u\n",
18 a, actual, expected);
19 return actual != expected;
21 #endif
23 int main()
25 #if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x4)
26 if (test__fixsfsivfp(0.0))
27 return 1;
28 if (test__fixsfsivfp(1.0))
29 return 1;
30 if (test__fixsfsivfp(-1.0))
31 return 1;
32 if (test__fixsfsivfp(2147483647.0))
33 return 1;
34 if (test__fixsfsivfp(-2147483648.0))
35 return 1;
36 if (test__fixsfsivfp(65536.0))
37 return 1;
38 #else
39 printf("skipped\n");
40 #endif
41 return 0;