1 //===--------------- floatunsitf_test.c - Test __floatunsitf --------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests __floatunsitf for the compiler_rt library.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include <stdio.h>
15
16 #if __LDBL_MANT_DIG__ == 113
17
18 #include "fp_test.h"
19
20 long double __floatunsitf(unsigned int a);
21
test__floatunsitf(unsigned int a,uint64_t expectedHi,uint64_t expectedLo)22 int test__floatunsitf(unsigned int a, uint64_t expectedHi, uint64_t expectedLo)
23 {
24 long double x = __floatunsitf(a);
25 int ret = compareResultLD(x, expectedHi, expectedLo);
26
27 if (ret){
28 printf("error in test__floatunsitf(%u) = %.20Lf, "
29 "expected %.20Lf\n", a, x, fromRep128(expectedHi, expectedLo));
30 }
31 return ret;
32 }
33
34 char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};
35
36 #endif
37
main()38 int main()
39 {
40 #if __LDBL_MANT_DIG__ == 113
41 if (test__floatunsitf(0x7fffffff, UINT64_C(0x401dfffffffc0000), UINT64_C(0x0)))
42 return 1;
43 if (test__floatunsitf(0, UINT64_C(0x0), UINT64_C(0x0)))
44 return 1;
45 if (test__floatunsitf(0xffffffff, UINT64_C(0x401efffffffe0000), UINT64_C(0x0)))
46 return 1;
47 if (test__floatunsitf(0x12345678, UINT64_C(0x401b234567800000), UINT64_C(0x0)))
48 return 1;
49
50 #else
51 printf("skipped\n");
52
53 #endif
54 return 0;
55 }
56