[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / builtins / Unit / gtdf2vfp_test.c
blob6f5ccd0890e0ce5f0d8f0b8fe03e3a344376e986
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_gtdf2vfp
4 //===-- gtdf2vfp_test.c - Test __gtdf2vfp ---------------------------------===//
5 //
6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 // See https://llvm.org/LICENSE.txt for license information.
8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //
10 //===----------------------------------------------------------------------===//
12 // This file tests __gtdf2vfp for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
16 #include <stdlib.h>
17 #include <stdint.h>
18 #include <stdio.h>
19 #include <math.h>
22 extern int __gtdf2vfp(double a, double b);
24 #if __arm__ && __VFP_FP__
25 int test__gtdf2vfp(double a, double b)
27 int actual = __gtdf2vfp(a, b);
28 int expected = (a > b) ? 1 : 0;
29 if (actual != expected)
30 printf("error in __gtdf2vfp(%f, %f) = %d, expected %d\n",
31 a, b, actual, expected);
32 return actual != expected;
34 #endif
36 int main()
38 #if __arm__ && __VFP_FP__
39 if (test__gtdf2vfp(0.0, 0.0))
40 return 1;
41 if (test__gtdf2vfp(1.0, 0.0))
42 return 1;
43 if (test__gtdf2vfp(-1.0, -2.0))
44 return 1;
45 if (test__gtdf2vfp(-2.0, -1.0))
46 return 1;
47 if (test__gtdf2vfp(HUGE_VALF, 1.0))
48 return 1;
49 if (test__gtdf2vfp(1.0, HUGE_VALF))
50 return 1;
51 #else
52 printf("skipped\n");
53 #endif
54 return 0;