• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- aeabi_drsub.c - Test __aeabi_drsub --------------------------------===//
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_drsub 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"))) double __aeabi_drsub(double a, double b);
21 
test__aeabi_drsub(double a,double b,double expected)22 int test__aeabi_drsub(double a, double b, double expected)
23 {
24     double actual = __aeabi_drsub(a, b);
25     if (actual != expected)
26         printf("error in __aeabi_drsub(%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_drsub(1.0, 1.0, 0.0))
36         return 1;
37     if (test__aeabi_drsub(1234.567, 765.4321, -469.134900))
38         return 1;
39     if (test__aeabi_drsub(-123.0, -678.0, -555.0))
40         return 1;
41     if (test__aeabi_drsub(0.0, -0.0, 0.0))
42         return 1;
43 #else
44     printf("skipped\n");
45 #endif
46     return 0;
47 }
48