1 // RUN: %clang_builtins %s %librt -o %t && %run %t 2 // REQUIRES: librt_has_floatunssidfvfp 3 //===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===// 4 // 5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6 // See https://llvm.org/LICENSE.txt for license information. 7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 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