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