1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_divsf3
3
4 #include "int_lib.h"
5 #include <stdio.h>
6
7 #include "fp_test.h"
8
9 // Returns: a / b
10 COMPILER_RT_ABI float __divsf3(float a, float b);
11
test__divsf3(float a,float b,uint32_t expected)12 int test__divsf3(float a, float b, uint32_t expected)
13 {
14 float x = __divsf3(a, b);
15 int ret = compareResultF(x, expected);
16
17 if (ret){
18 printf("error in test__divsf3(%.20e, %.20e) = %.20e, "
19 "expected %.20e\n", a, b, x,
20 fromRep32(expected));
21 }
22 return ret;
23 }
24
main()25 int main()
26 {
27 // 1/3
28 if (test__divsf3(1.f, 3.f, 0x3EAAAAABU))
29 return 1;
30 // smallest normal result
31 if (test__divsf3(2.3509887e-38, 2., 0x00800000U))
32 return 1;
33
34 return 0;
35 }
36