xref: /aosp_15_r20/external/compiler-rt/test/builtins/Unit/nedf2vfp_test.c (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot //===-- nedf2vfp_test.c - Test __nedf2vfp ---------------------------------===//
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 __nedf2vfp for the compiler_rt library.
11*7c3d14c8STreehugger Robot //
12*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===//
13*7c3d14c8STreehugger Robot 
14*7c3d14c8STreehugger Robot #include <stdlib.h>
15*7c3d14c8STreehugger Robot #include <stdint.h>
16*7c3d14c8STreehugger Robot #include <stdio.h>
17*7c3d14c8STreehugger Robot #include <math.h>
18*7c3d14c8STreehugger Robot 
19*7c3d14c8STreehugger Robot 
20*7c3d14c8STreehugger Robot extern int __nedf2vfp(double a, double b);
21*7c3d14c8STreehugger Robot 
22*7c3d14c8STreehugger Robot #if __arm__
test__nedf2vfp(double a,double b)23*7c3d14c8STreehugger Robot int test__nedf2vfp(double a, double b)
24*7c3d14c8STreehugger Robot {
25*7c3d14c8STreehugger Robot     int actual = __nedf2vfp(a, b);
26*7c3d14c8STreehugger Robot 	int expected = (a != b) ? 1 : 0;
27*7c3d14c8STreehugger Robot     if (actual != expected)
28*7c3d14c8STreehugger Robot         printf("error in __nedf2vfp(%f, %f) = %d, expected %d\n",
29*7c3d14c8STreehugger Robot                a, b, actual, expected);
30*7c3d14c8STreehugger Robot     return actual != expected;
31*7c3d14c8STreehugger Robot }
32*7c3d14c8STreehugger Robot #endif
33*7c3d14c8STreehugger Robot 
main()34*7c3d14c8STreehugger Robot int main()
35*7c3d14c8STreehugger Robot {
36*7c3d14c8STreehugger Robot #if __arm__
37*7c3d14c8STreehugger Robot     if (test__nedf2vfp(0.0, 0.0))
38*7c3d14c8STreehugger Robot         return 1;
39*7c3d14c8STreehugger Robot     if (test__nedf2vfp(1.0, 1.0))
40*7c3d14c8STreehugger Robot         return 1;
41*7c3d14c8STreehugger Robot     if (test__nedf2vfp(-1.0, -1.0))
42*7c3d14c8STreehugger Robot         return 1;
43*7c3d14c8STreehugger Robot     if (test__nedf2vfp(HUGE_VAL, 1.0))
44*7c3d14c8STreehugger Robot         return 1;
45*7c3d14c8STreehugger Robot     if (test__nedf2vfp(1.0, HUGE_VAL))
46*7c3d14c8STreehugger Robot         return 1;
47*7c3d14c8STreehugger Robot #else
48*7c3d14c8STreehugger Robot     printf("skipped\n");
49*7c3d14c8STreehugger Robot #endif
50*7c3d14c8STreehugger Robot     return 0;
51*7c3d14c8STreehugger Robot }
52