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 "int_lib.h" 15 #include <stdio.h> 16 17 #if __LDBL_MANT_DIG__ == 113 18 19 #include "fp_test.h" 20 21 COMPILER_RT_ABI long double __floatunsitf(unsigned int a); 22 23 int test__floatunsitf(unsigned int a, uint64_t expectedHi, uint64_t expectedLo) 24 { 25 long double x = __floatunsitf(a); 26 int ret = compareResultLD(x, expectedHi, expectedLo); 27 28 if (ret){ 29 printf("error in test__floatunsitf(%u) = %.20Lf, " 30 "expected %.20Lf\n", a, x, fromRep128(expectedHi, expectedLo)); 31 } 32 return ret; 33 } 34 35 char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0}; 36 37 #endif 38 39 int main() 40 { 41 #if __LDBL_MANT_DIG__ == 113 42 if (test__floatunsitf(0x7fffffff, UINT64_C(0x401dfffffffc0000), UINT64_C(0x0))) 43 return 1; 44 if (test__floatunsitf(0, UINT64_C(0x0), UINT64_C(0x0))) 45 return 1; 46 if (test__floatunsitf(0xffffffff, UINT64_C(0x401efffffffe0000), UINT64_C(0x0))) 47 return 1; 48 if (test__floatunsitf(0x12345678, UINT64_C(0x401b234567800000), UINT64_C(0x0))) 49 return 1; 50 51 #else 52 printf("skipped\n"); 53 54 #endif 55 return 0; 56 } 57