[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / builtins / Unit / divdf3_test.c
blob28eb4eb892de133345a6426ac330448fffc0cfb2
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_divdf3
3 //===--------------- divdf3_test.c - Test __divdf3 ------------------------===//
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 __divdf3 for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
15 #include "int_lib.h"
16 #include <stdio.h>
18 #include "fp_test.h"
20 // Returns: a / b
21 COMPILER_RT_ABI double __divdf3(double a, double b);
23 int test__divdf3(double a, double b, uint64_t expected)
25 double x = __divdf3(a, b);
26 int ret = compareResultD(x, expected);
28 if (ret){
29 printf("error in test__divdf3(%.20e, %.20e) = %.20e, "
30 "expected %.20e\n", a, b, x,
31 fromRep64(expected));
33 return ret;
36 int main()
38 // 1/3
39 if (test__divdf3(1., 3., 0x3fd5555555555555ULL))
40 return 1;
41 // smallest normal result
42 if (test__divdf3(4.450147717014403e-308, 2., 0x10000000000000ULL))
43 return 1;
45 return 0;