[GlobalISel] Avoid repeated hash lookups (NFC) (#124393)
[llvm-project.git] / compiler-rt / test / builtins / Unit / fixdfsivfp_test.c
blob7ffe449b8d76a9b4aa10ff06836d9aaba876100b
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixdfsivfp
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <math.h>
9 extern int __fixdfsivfp(double a);
11 #if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x8)
12 int test__fixdfsivfp(double a)
14 int actual = __fixdfsivfp(a);
15 int expected = a;
16 if (actual != expected)
17 printf("error in test__fixdfsivfp(%f) = %d, expected %d\n",
18 a, actual, expected);
19 return actual != expected;
21 #endif
23 int main()
25 #if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x8)
26 if (test__fixdfsivfp(0.0))
27 return 1;
28 if (test__fixdfsivfp(1.0))
29 return 1;
30 if (test__fixdfsivfp(-1.0))
31 return 1;
32 if (test__fixdfsivfp(2147483647))
33 return 1;
34 if (test__fixdfsivfp(-2147483648.0))
35 return 1;
36 #else
37 printf("skipped\n");
38 #endif
39 return 0;