1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_extendsftf2
3 //===--------------- extendsftf2_test.c - Test __extendsftf2 --------------===//
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
9 //===----------------------------------------------------------------------===//
11 // This file tests __extendsftf2 for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
18 #if __LDBL_MANT_DIG__ == 113
22 COMPILER_RT_ABI
long double __extendsftf2(float a
);
24 int test__extendsftf2(float a
, uint64_t expectedHi
, uint64_t expectedLo
)
26 long double x
= __extendsftf2(a
);
27 int ret
= compareResultLD(x
, expectedHi
, expectedLo
);
31 printf("error in test__extendsftf2(%f) = %.20Lf, "
32 "expected %.20Lf\n", a
, x
, fromRep128(expectedHi
, expectedLo
));
37 char assumption_1
[sizeof(long double) * CHAR_BIT
== 128] = {0};
43 #if __LDBL_MANT_DIG__ == 113
45 if (test__extendsftf2(makeQNaN32(),
46 UINT64_C(0x7fff800000000000),
50 if (test__extendsftf2(makeNaN32(UINT32_C(0x410000)),
51 UINT64_C(0x7fff820000000000),
55 if (test__extendsftf2(makeInf32(),
56 UINT64_C(0x7fff000000000000),
60 if (test__extendsftf2(0.0f
, UINT64_C(0x0), UINT64_C(0x0)))
63 if (test__extendsftf2(0x1.23456p
+5f
,
64 UINT64_C(0x4004234560000000),
67 if (test__extendsftf2(0x1.edcbap
-9f
,
68 UINT64_C(0x3ff6edcba0000000),
71 if (test__extendsftf2(0x1.23456p
+45f
,
72 UINT64_C(0x402c234560000000),
75 if (test__extendsftf2(0x1.edcbap
-45f
,
76 UINT64_C(0x3fd2edcba0000000),