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