[compiler-rt] [builtins] Support building the 128-bit float functions on x86 (PR #68132)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 10:38:41 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 6f43d28f3452b3ef598bc12b761cfc2dbd0f34c9 58742dd68f4527b13561592e19d64a5f07991872 -- compiler-rt/lib/builtins/divtc3.c compiler-rt/lib/builtins/extenddftf2.c compiler-rt/lib/builtins/extendhftf2.c compiler-rt/lib/builtins/extendsftf2.c compiler-rt/lib/builtins/floattitf.c compiler-rt/lib/builtins/floatuntitf.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_types.h compiler-rt/lib/builtins/multc3.c compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/trunctfdf2.c compiler-rt/lib/builtins/trunctfhf2.c compiler-rt/lib/builtins/trunctfsf2.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/floattitf_test.c compiler-rt/test/builtins/Unit/floatunditf_test.c compiler-rt/test/builtins/Unit/floatuntitf_test.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/test/builtins/Unit/addtf3_test.c b/compiler-rt/test/builtins/Unit/addtf3_test.c
index 9d2ccf027d73..2fd2e797f0a1 100644
--- a/compiler-rt/test/builtins/Unit/addtf3_test.c
+++ b/compiler-rt/test/builtins/Unit/addtf3_test.c
@@ -12,19 +12,18 @@
// Returns: a + b
COMPILER_RT_ABI tf_float __addtf3(tf_float a, tf_float b);
-int test__addtf3(tf_float a, tf_float b,
- uint64_t expectedHi, uint64_t expectedLo)
-{
- tf_float x = __addtf3(a, b);
- int ret = compareResultLD(x, expectedHi, expectedLo);
-
- if (ret){
- printf("error in test__addtf3(%.20Lf, %.20Lf) = %.20Lf, "
- "expected %.20Lf\n", a, b, x,
- fromRep128(expectedHi, expectedLo));
- }
-
- return ret;
+int test__addtf3(tf_float a, tf_float b, uint64_t expectedHi,
+ uint64_t expectedLo) {
+ tf_float x = __addtf3(a, b);
+ int ret = compareResultLD(x, expectedHi, expectedLo);
+
+ if (ret) {
+ printf("error in test__addtf3(%.20Lf, %.20Lf) = %.20Lf, "
+ "expected %.20Lf\n",
+ a, b, x, fromRep128(expectedHi, expectedLo));
+ }
+
+ return ret;
}
char assumption_1[sizeof(tf_float) * CHAR_BIT == 128] = {0};
@@ -42,10 +41,9 @@ int main()
return 1;
// NaN + any = NaN
if (test__addtf3(makeNaN128(UINT64_C(0x800030000000)),
- TF_C(0x1.23456789abcdefp+5),
- UINT64_C(0x7fff800000000000),
+ TF_C(0x1.23456789abcdefp+5), UINT64_C(0x7fff800000000000),
UINT64_C(0x0)))
- return 1;
+ return 1;
// inf + inf = inf
if (test__addtf3(makeInf128(),
makeInf128(),
@@ -53,21 +51,19 @@ int main()
UINT64_C(0x0)))
return 1;
// inf + any = inf
- if (test__addtf3(makeInf128(),
- TF_C(0x1.2335653452436234723489432abcdefp+5),
- UINT64_C(0x7fff000000000000),
- UINT64_C(0x0)))
- return 1;
+ if (test__addtf3(makeInf128(), TF_C(0x1.2335653452436234723489432abcdefp+5),
+ UINT64_C(0x7fff000000000000), UINT64_C(0x0)))
+ return 1;
// any + any
if (test__addtf3(TF_C(0x1.23456734245345543849abcdefp+5),
TF_C(0x1.edcba52449872455634654321fp-1),
UINT64_C(0x40042afc95c8b579),
UINT64_C(0x61e58dd6c51eb77c)))
- return 1;
+ return 1;
-#if (defined(__arm__) || defined(__aarch64__)) && defined(__ARM_FP) || \
- defined(i386) || defined(__x86_64__) || (defined(__loongarch__) && \
- __loongarch_frlen != 0)
+# if (defined(__arm__) || defined(__aarch64__)) && defined(__ARM_FP) || \
+ defined(i386) || defined(__x86_64__) || \
+ (defined(__loongarch__) && __loongarch_frlen != 0)
// Rounding mode tests on supported architectures
const tf_float m = 1234.0L, n = 0.01L;
diff --git a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c
index 59c95e73dacc..09a5fdc87af2 100644
--- a/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c
+++ b/compiler-rt/test/builtins/Unit/compiler_rt_scalbnl_test.c
@@ -81,4 +81,3 @@ int main() {
return 0;
}
#endif
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/68132
More information about the llvm-commits
mailing list