[compiler-rt] [builtins] Avoid using long double in generic sources (PR #69754)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 12:25:07 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 20fc8e8df20e165d1c632bc80a0cebce2dc158f7 6298a09fbd99ed69ad53e0d766cbe4d971a9642d -- compiler-rt/lib/builtins/divtc3.c compiler-rt/lib/builtins/divxc3.c compiler-rt/lib/builtins/extenddftf2.c compiler-rt/lib/builtins/extendhftf2.c compiler-rt/lib/builtins/extendsftf2.c compiler-rt/lib/builtins/extendxftf2.c compiler-rt/lib/builtins/fixunsxfdi.c compiler-rt/lib/builtins/fixunsxfsi.c compiler-rt/lib/builtins/fixunsxfti.c compiler-rt/lib/builtins/fixxfdi.c compiler-rt/lib/builtins/fixxfti.c compiler-rt/lib/builtins/floatdixf.c compiler-rt/lib/builtins/floattixf.c compiler-rt/lib/builtins/floatundixf.c compiler-rt/lib/builtins/floatuntixf.c compiler-rt/lib/builtins/fp_extend.h compiler-rt/lib/builtins/fp_lib.h compiler-rt/lib/builtins/fp_trunc.h compiler-rt/lib/builtins/int_math.h compiler-rt/lib/builtins/int_to_fp.h compiler-rt/lib/builtins/int_types.h compiler-rt/lib/builtins/multc3.c compiler-rt/lib/builtins/mulxc3.c compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/powixf2.c compiler-rt/lib/builtins/ppc/multc3.c compiler-rt/lib/builtins/trunctfdf2.c compiler-rt/lib/builtins/trunctfhf2.c compiler-rt/lib/builtins/trunctfsf2.c compiler-rt/lib/builtins/trunctfxf2.c compiler-rt/lib/builtins/x86_64/floatdixf.c compiler-rt/test/builtins/Unit/addtf3_test.c compiler-rt/test/builtins/Unit/compiler_rt_fmaxl_test.c compiler-rt/test/builtins/Unit/compiler_rt_logbl_test.c compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c compiler-rt/test/builtins/Unit/divtc3_test.c compiler-rt/test/builtins/Unit/divtf3_test.c compiler-rt/test/builtins/Unit/extendxftf2_test.c compiler-rt/test/builtins/Unit/floatditf_test.c compiler-rt/test/builtins/Unit/floattitf_test.c compiler-rt/test/builtins/Unit/floatunditf_test.c compiler-rt/test/builtins/Unit/floatunsitf_test.c compiler-rt/test/builtins/Unit/floatuntitf_test.c compiler-rt/test/builtins/Unit/fp_test.h compiler-rt/test/builtins/Unit/trunctfxf2_test.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/builtins/divxc3.c b/compiler-rt/lib/builtins/divxc3.c
index cbf5299a14e8..3423334f2006 100644
--- a/compiler-rt/lib/builtins/divxc3.c
+++ b/compiler-rt/lib/builtins/divxc3.c
@@ -17,8 +17,8 @@
// Returns: the quotient of (a + ib) / (c + id)
-COMPILER_RT_ABI Lcomplex __divxc3(xf_float __a, xf_float __b,
- xf_float __c, xf_float __d) {
+COMPILER_RT_ABI Lcomplex __divxc3(xf_float __a, xf_float __b, xf_float __c,
+ xf_float __d) {
int __ilogbw = 0;
xf_float __logbw = crt_logbl(crt_fmaxl(crt_fabsl(__c), crt_fabsl(__d)));
if (crt_isfinite(__logbw)) {
diff --git a/compiler-rt/lib/builtins/mulxc3.c b/compiler-rt/lib/builtins/mulxc3.c
index 6abaab0fbbe4..66b5b58190f7 100644
--- a/compiler-rt/lib/builtins/mulxc3.c
+++ b/compiler-rt/lib/builtins/mulxc3.c
@@ -17,8 +17,8 @@
// Returns: the product of a + ib and c + id
-COMPILER_RT_ABI Lcomplex __mulxc3(xf_float __a, xf_float __b,
- xf_float __c, xf_float __d) {
+COMPILER_RT_ABI Lcomplex __mulxc3(xf_float __a, xf_float __b, xf_float __c,
+ xf_float __d) {
xf_float __ac = __a * __c;
xf_float __bd = __b * __d;
xf_float __ad = __a * __d;
diff --git a/compiler-rt/lib/builtins/trunctfxf2.c b/compiler-rt/lib/builtins/trunctfxf2.c
index f9ec7192e561..49bd32d42aac 100644
--- a/compiler-rt/lib/builtins/trunctfxf2.c
+++ b/compiler-rt/lib/builtins/trunctfxf2.c
@@ -18,8 +18,6 @@
#define DST_80
#include "fp_trunc_impl.inc"
-COMPILER_RT_ABI xf_float __trunctfxf2(tf_float a) {
- return __truncXfYf2__(a);
-}
+COMPILER_RT_ABI xf_float __trunctfxf2(tf_float a) { return __truncXfYf2__(a); }
#endif
diff --git a/compiler-rt/test/builtins/Unit/fp_test.h b/compiler-rt/test/builtins/Unit/fp_test.h
index 4eb54b7425c1..ccf64090f09c 100644
--- a/compiler-rt/test/builtins/Unit/fp_test.h
+++ b/compiler-rt/test/builtins/Unit/fp_test.h
@@ -42,10 +42,10 @@ static inline double fromRep64(uint64_t x)
#if defined(CRT_HAS_TF_MODE)
static inline tf_float fromRep128(uint64_t hi, uint64_t lo) {
- __uint128_t x = ((__uint128_t)hi << 64) + lo;
- tf_float ret;
- memcpy(&ret, &x, 16);
- return ret;
+ __uint128_t x = ((__uint128_t)hi << 64) + lo;
+ tf_float ret;
+ memcpy(&ret, &x, 16);
+ return ret;
}
#endif
@@ -76,9 +76,9 @@ static inline uint64_t toRep64(double x)
#if defined(CRT_HAS_TF_MODE)
static inline __uint128_t toRep128(tf_float x) {
- __uint128_t ret;
- memcpy(&ret, &x, 16);
- return ret;
+ __uint128_t ret;
+ memcpy(&ret, &x, 16);
+ return ret;
}
#endif
@@ -142,21 +142,21 @@ static inline int compareResultD(double result,
// because 128-bit integer constant can't be assigned directly
static inline int compareResultF128(tf_float result, uint64_t expectedHi,
uint64_t expectedLo) {
- __uint128_t rep = toRep128(result);
- uint64_t hi = rep >> 64;
- uint64_t lo = rep;
-
- if (hi == expectedHi && lo == expectedLo) {
- return 0;
+ __uint128_t rep = toRep128(result);
+ uint64_t hi = rep >> 64;
+ uint64_t lo = rep;
+
+ if (hi == expectedHi && lo == expectedLo) {
+ return 0;
+ }
+ // test other possible NaN representation(signal NaN)
+ else if (expectedHi == 0x7fff800000000000UL && expectedLo == 0x0UL) {
+ if ((hi & 0x7fff000000000000UL) == 0x7fff000000000000UL &&
+ ((hi & 0xffffffffffffUL) > 0 || lo > 0)) {
+ return 0;
}
- // test other possible NaN representation(signal NaN)
- else if (expectedHi == 0x7fff800000000000UL && expectedLo == 0x0UL) {
- if ((hi & 0x7fff000000000000UL) == 0x7fff000000000000UL &&
- ((hi & 0xffffffffffffUL) > 0 || lo > 0)) {
- return 0;
- }
- }
- return 1;
+ }
+ return 1;
}
#endif
@@ -269,7 +269,7 @@ static inline long double makeInf80(void) {
#if defined(CRT_HAS_TF_MODE)
static inline tf_float makeQNaN128(void) {
- return fromRep128(0x7fff800000000000UL, 0x0UL);
+ return fromRep128(0x7fff800000000000UL, 0x0UL);
}
#endif
@@ -290,7 +290,7 @@ static inline double makeNaN64(uint64_t rand)
#if defined(CRT_HAS_TF_MODE)
static inline tf_float makeNaN128(uint64_t rand) {
- return fromRep128(0x7fff000000000000UL | (rand & 0xffffffffffffUL), 0x0UL);
+ return fromRep128(0x7fff000000000000UL | (rand & 0xffffffffffffUL), 0x0UL);
}
#endif
@@ -321,10 +321,10 @@ static inline double makeNegativeInf64(void)
#if defined(CRT_HAS_TF_MODE)
static inline tf_float makeInf128(void) {
- return fromRep128(0x7fff000000000000UL, 0x0UL);
+ return fromRep128(0x7fff000000000000UL, 0x0UL);
}
static inline tf_float makeNegativeInf128(void) {
- return fromRep128(0xffff000000000000UL, 0x0UL);
+ return fromRep128(0xffff000000000000UL, 0x0UL);
}
#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/69754
More information about the llvm-commits
mailing list