• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- aeabi_frsub.c - Test __aeabi_frsub --------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests __aeabi_frsub for the compiler_rt library.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <math.h>
17 
18 
19 #if __arm__
20 extern __attribute__((pcs("aapcs"))) float __aeabi_frsub(float a, float b);
21 
test__aeabi_frsub(float a,float b,float expected)22 int test__aeabi_frsub(float a, float b, float expected)
23 {
24     float actual = __aeabi_frsub(a, b);
25     if (actual != expected)
26         printf("error in __aeabi_frsub(%f, %f) = %f, expected %f\n",
27                a, b, actual, expected);
28     return actual != expected;
29 }
30 #endif
31 
main()32 int main()
33 {
34 #if __arm__
35     if (test__aeabi_frsub(1.0, 1.0, 0.0))
36         return 1;
37     if (test__aeabi_frsub(1234.567, 765.4321, -469.134900))
38         return 1;
39     if (test__aeabi_frsub(-123.0, -678.0, -555.0))
40         return 1;
41     if (test__aeabi_frsub(0.0, -0.0, 0.0))
42         return 1;
43 #else
44     printf("skipped\n");
45 #endif
46     return 0;
47 }
48