1 // RUN: %clang_builtins %s %librt -o %t && %run %t 2 //===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 // 11 // This file tests __floatunssidfvfp for the compiler_rt library. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #include "int_lib.h" 16 #include <stdio.h> 17 #include <stdlib.h> 18 #include <math.h> 19 20 21 extern COMPILER_RT_ABI double __floatunssidfvfp(unsigned int a); 22 23 #if __arm__ && __VFP_FP__ 24 int test__floatunssidfvfp(unsigned int a) 25 { 26 double actual = __floatunssidfvfp(a); 27 double expected = a; 28 if (actual != expected) 29 printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n", 30 a, actual, expected); 31 return actual != expected; 32 } 33 #endif 34 35 int main() 36 { 37 #if __arm__ && __VFP_FP__ 38 if (test__floatunssidfvfp(0)) 39 return 1; 40 if (test__floatunssidfvfp(1)) 41 return 1; 42 if (test__floatunssidfvfp(0x7FFFFFFF)) 43 return 1; 44 if (test__floatunssidfvfp(0x80000000)) 45 return 1; 46 if (test__floatunssidfvfp(0xFFFFFFFF)) 47 return 1; 48 #else 49 printf("skipped\n"); 50 #endif 51 return 0; 52 } 53