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