1// RUN: %clang_builtins %s %librt -o %t && %run %t
2// REQUIRES: librt_has_fixunssfsivfp
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <math.h>
7
8
9extern unsigned int __fixunssfsivfp(float a);
10
11#if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x4)
12int test__fixunssfsivfp(float a)
13{
14 unsigned int actual = __fixunssfsivfp(a);
15 unsigned int expected = a;
16 if (actual != expected)
17 printf("error in test__fixunssfsivfp(%f) = %u, expected %u\n",
18 a, actual, expected);
19 return actual != expected;
20}
21#endif
22
23int main()
24{
25#if defined(__arm__) && defined(__ARM_FP) && (__ARM_FP & 0x4)
26 if (test__fixunssfsivfp(0.0))
27 return 1;
28 if (test__fixunssfsivfp(1.0))
29 return 1;
30 if (test__fixunssfsivfp(-1.0))
31 return 1;
32 if (test__fixunssfsivfp(4294967295.0))
33 return 1;
34 if (test__fixunssfsivfp(65536.0))
35 return 1;
36#else
37 printf(format: "skipped\n");
38#endif
39 return 0;
40}
41

source code of compiler-rt/test/builtins/Unit/fixunssfsivfp_test.c