[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / builtins / Unit / divsf3vfp_test.c
blobfb0d892358fcd2539c5ded7d18dc9d7522beff7c
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_divsf3vfp
3 //===-- divsf3vfp_test.c - Test __divsf3vfp -------------------------------===//
4 //
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //
9 //===----------------------------------------------------------------------===//
11 // This file tests __divsf3vfp for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
15 #include "int_lib.h"
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <math.h>
21 extern COMPILER_RT_ABI float __divsf3vfp(float a, float b);
23 #if __arm__ && __VFP_FP__
24 int test__divsf3vfp(float a, float b)
26 float actual = __divsf3vfp(a, b);
27 float expected = a / b;
28 if (actual != expected)
29 printf("error in test__divsf3vfp(%f, %f) = %f, expected %f\n",
30 a, b, actual, expected);
31 return actual != expected;
33 #endif
35 int main()
37 #if __arm__ && __VFP_FP__
38 if (test__divsf3vfp(1.0, 1.0))
39 return 1;
40 if (test__divsf3vfp(12345.678, 1.23))
41 return 1;
42 if (test__divsf3vfp(0.0, HUGE_VALF))
43 return 1;
44 if (test__divsf3vfp(10.0, -2.0))
45 return 1;
46 #else
47 printf("skipped\n");
48 #endif
49 return 0;