1// RUN: %clang_builtins %s %librt -o %t && %run %t 2//===--------------- divdf3_test.c - Test __divdf3 ------------------------===// 3// 4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5// See https://llvm.org/LICENSE.txt for license information. 6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7// 8//===----------------------------------------------------------------------===// 9// 10// This file tests __divdf3 for the compiler_rt library. 11// 12//===----------------------------------------------------------------------===// 13 14#include "int_lib.h" 15#include <stdio.h> 16 17#include "fp_test.h" 18 19// Returns: a / b 20COMPILER_RT_ABI double __divdf3(double a, double b); 21 22int test__divdf3(double a, double b, uint64_t expected) 23{ 24 double x = __divdf3(a, b); 25 int ret = compareResultD(x, expected); 26 27 if (ret){ 28 printf("error in test__divdf3(%.20e, %.20e) = %.20e, " 29 "expected %.20e\n", a, b, x, 30 fromRep64(expected)); 31 } 32 return ret; 33} 34 35int main() 36{ 37 // 1/3 38 if (test__divdf3(1., 3., 0x3fd5555555555555ULL)) 39 return 1; 40 // smallest normal result 41 if (test__divdf3(4.450147717014403e-308, 2., 0x10000000000000ULL)) 42 return 1; 43 44 return 0; 45} 46