-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Revert "[compiler-rt][ARM] Optimized mulsf3 and divsf3" #167906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit f7e6521.
You can test this locally with the following command:git-clang-format --diff origin/main HEAD --extensions c -- compiler-rt/test/builtins/Unit/divsf3_test.c --diff_from_common_commit
View the diff from clang-format here.diff --git a/compiler-rt/test/builtins/Unit/divsf3_test.c b/compiler-rt/test/builtins/Unit/divsf3_test.c
index f8cb6169a..e4a227976 100644
--- a/compiler-rt/test/builtins/Unit/divsf3_test.c
+++ b/compiler-rt/test/builtins/Unit/divsf3_test.c
@@ -9,107 +9,105 @@
// Returns: a / b
COMPILER_RT_ABI float __divsf3(float a, float b);
-int test__divsf3(float a, float b, uint32_t expected)
-{
- float x = __divsf3(a, b);
- int ret = compareResultF(x, expected);
-
- if (ret){
- printf("error in test__divsf3(%.20e, %.20e) = %.20e, "
- "expected %.20e\n", a, b, x,
- fromRep32(expected));
- }
- return ret;
+int test__divsf3(float a, float b, uint32_t expected) {
+ float x = __divsf3(a, b);
+ int ret = compareResultF(x, expected);
+
+ if (ret) {
+ printf("error in test__divsf3(%.20e, %.20e) = %.20e, "
+ "expected %.20e\n",
+ a, b, x, fromRep32(expected));
+ }
+ return ret;
}
-int main()
-{
- // Returned NaNs are assumed to be qNaN by default
-
- // qNaN / any = qNaN
- if (test__divsf3(makeQNaN32(), 3.F, UINT32_C(0x7fc00000)))
- return 1;
- // NaN / any = NaN
- if (test__divsf3(makeNaN32(UINT32_C(0x123)), 3.F, UINT32_C(0x7fc00000)))
- return 1;
- // any / qNaN = qNaN
- if (test__divsf3(3.F, makeQNaN32(), UINT32_C(0x7fc00000)))
- return 1;
- // any / NaN = NaN
- if (test__divsf3(3.F, makeNaN32(UINT32_C(0x123)), UINT32_C(0x7fc00000)))
- return 1;
-
- // +Inf / positive = +Inf
- if (test__divsf3(makeInf32(), 3.F, UINT32_C(0x7f800000)))
- return 1;
- // +Inf / negative = -Inf
- if (test__divsf3(makeInf32(), -3.F, UINT32_C(0xff800000)))
- return 1;
- // -Inf / positive = -Inf
- if (test__divsf3(makeNegativeInf32(), 3.F, UINT32_C(0xff800000)))
- return 1;
- // -Inf / negative = +Inf
- if (test__divsf3(makeNegativeInf32(), -3.F, UINT32_C(0x7f800000)))
- return 1;
-
- // Inf / Inf = NaN
- if (test__divsf3(makeInf32(), makeInf32(), UINT32_C(0x7fc00000)))
- return 1;
- // 0.0 / 0.0 = NaN
- if (test__divsf3(+0x0.0p+0F, +0x0.0p+0F, UINT32_C(0x7fc00000)))
- return 1;
- // +0.0 / +Inf = +0.0
- if (test__divsf3(+0x0.0p+0F, makeInf32(), UINT32_C(0x0)))
- return 1;
- // +Inf / +0.0 = +Inf
- if (test__divsf3(makeInf32(), +0x0.0p+0F, UINT32_C(0x7f800000)))
- return 1;
-
- // positive / +0.0 = +Inf
- if (test__divsf3(+1.F, +0x0.0p+0F, UINT32_C(0x7f800000)))
- return 1;
- // positive / -0.0 = -Inf
- if (test__divsf3(+1.F, -0x0.0p+0F, UINT32_C(0xff800000)))
- return 1;
- // negative / +0.0 = -Inf
- if (test__divsf3(-1.F, +0x0.0p+0F, UINT32_C(0xff800000)))
- return 1;
- // negative / -0.0 = +Inf
- if (test__divsf3(-1.F, -0x0.0p+0F, UINT32_C(0x7f800000)))
- return 1;
-
- // 1/3
- if (test__divsf3(1.F, 3.F, UINT32_C(0x3eaaaaab)))
- return 1;
- // smallest normal result
- if (test__divsf3(0x1.0p-125F, 2.F, UINT32_C(0x00800000)))
- return 1;
-
- // divisor is exactly 1.0
- if (test__divsf3(0x1.0p+0F, 0x1.0p+0F, UINT32_C(0x3f800000)))
- return 1;
- // divisor is truncated to exactly 1.0 in UQ1.15
- if (test__divsf3(0x1.0p+0F, 0x1.0001p+0F, UINT32_C(0x3f7fff00)))
- return 1;
-
- // smallest normal value divided by 2.0
- if (test__divsf3(0x1.0p-126F, 2.0F, UINT32_C(0x00400000)))
- return 1;
- // smallest subnormal result
- if (test__divsf3(0x1.0p-126F, 0x1p+23F, UINT32_C(0x00000001)))
- return 1;
-
- // some misc test cases obtained by fuzzing against h/w implementation
- if (test__divsf3(-0x1.3e75e6p-108F, -0x1.cf372p+38F, UINT32_C(0x00000006)))
- return 1;
- if (test__divsf3(0x1.e77c54p+81F, -0x1.e77c52p-47F, UINT32_C(0xff800000)))
- return 1;
- if (test__divsf3(0x1.fffffep-126F, 2.F, UINT32_C(0x00800000)))
- return 1;
-
- // test 1 / (1 - eps(0.5)) = 1 + eps(1)
- if (test__divsf3(1.0F, 0x1.fffffep-1F, UINT32_C(0x3f800001)))
- return 1;
-
- return 0;
+int main() {
+ // Returned NaNs are assumed to be qNaN by default
+
+ // qNaN / any = qNaN
+ if (test__divsf3(makeQNaN32(), 3.F, UINT32_C(0x7fc00000)))
+ return 1;
+ // NaN / any = NaN
+ if (test__divsf3(makeNaN32(UINT32_C(0x123)), 3.F, UINT32_C(0x7fc00000)))
+ return 1;
+ // any / qNaN = qNaN
+ if (test__divsf3(3.F, makeQNaN32(), UINT32_C(0x7fc00000)))
+ return 1;
+ // any / NaN = NaN
+ if (test__divsf3(3.F, makeNaN32(UINT32_C(0x123)), UINT32_C(0x7fc00000)))
+ return 1;
+
+ // +Inf / positive = +Inf
+ if (test__divsf3(makeInf32(), 3.F, UINT32_C(0x7f800000)))
+ return 1;
+ // +Inf / negative = -Inf
+ if (test__divsf3(makeInf32(), -3.F, UINT32_C(0xff800000)))
+ return 1;
+ // -Inf / positive = -Inf
+ if (test__divsf3(makeNegativeInf32(), 3.F, UINT32_C(0xff800000)))
+ return 1;
+ // -Inf / negative = +Inf
+ if (test__divsf3(makeNegativeInf32(), -3.F, UINT32_C(0x7f800000)))
+ return 1;
+
+ // Inf / Inf = NaN
+ if (test__divsf3(makeInf32(), makeInf32(), UINT32_C(0x7fc00000)))
+ return 1;
+ // 0.0 / 0.0 = NaN
+ if (test__divsf3(+0x0.0p+0F, +0x0.0p+0F, UINT32_C(0x7fc00000)))
+ return 1;
+ // +0.0 / +Inf = +0.0
+ if (test__divsf3(+0x0.0p+0F, makeInf32(), UINT32_C(0x0)))
+ return 1;
+ // +Inf / +0.0 = +Inf
+ if (test__divsf3(makeInf32(), +0x0.0p+0F, UINT32_C(0x7f800000)))
+ return 1;
+
+ // positive / +0.0 = +Inf
+ if (test__divsf3(+1.F, +0x0.0p+0F, UINT32_C(0x7f800000)))
+ return 1;
+ // positive / -0.0 = -Inf
+ if (test__divsf3(+1.F, -0x0.0p+0F, UINT32_C(0xff800000)))
+ return 1;
+ // negative / +0.0 = -Inf
+ if (test__divsf3(-1.F, +0x0.0p+0F, UINT32_C(0xff800000)))
+ return 1;
+ // negative / -0.0 = +Inf
+ if (test__divsf3(-1.F, -0x0.0p+0F, UINT32_C(0x7f800000)))
+ return 1;
+
+ // 1/3
+ if (test__divsf3(1.F, 3.F, UINT32_C(0x3eaaaaab)))
+ return 1;
+ // smallest normal result
+ if (test__divsf3(0x1.0p-125F, 2.F, UINT32_C(0x00800000)))
+ return 1;
+
+ // divisor is exactly 1.0
+ if (test__divsf3(0x1.0p+0F, 0x1.0p+0F, UINT32_C(0x3f800000)))
+ return 1;
+ // divisor is truncated to exactly 1.0 in UQ1.15
+ if (test__divsf3(0x1.0p+0F, 0x1.0001p+0F, UINT32_C(0x3f7fff00)))
+ return 1;
+
+ // smallest normal value divided by 2.0
+ if (test__divsf3(0x1.0p-126F, 2.0F, UINT32_C(0x00400000)))
+ return 1;
+ // smallest subnormal result
+ if (test__divsf3(0x1.0p-126F, 0x1p+23F, UINT32_C(0x00000001)))
+ return 1;
+
+ // some misc test cases obtained by fuzzing against h/w implementation
+ if (test__divsf3(-0x1.3e75e6p-108F, -0x1.cf372p+38F, UINT32_C(0x00000006)))
+ return 1;
+ if (test__divsf3(0x1.e77c54p+81F, -0x1.e77c52p-47F, UINT32_C(0xff800000)))
+ return 1;
+ if (test__divsf3(0x1.fffffep-126F, 2.F, UINT32_C(0x00800000)))
+ return 1;
+
+ // test 1 / (1 - eps(0.5)) = 1 + eps(1)
+ if (test__divsf3(1.0F, 0x1.fffffep-1F, UINT32_C(0x3f800001)))
+ return 1;
+
+ return 0;
}
|
|
I have to land this revert without CI being happy, because if nothing else, the code formatting check is never going to be happy – a side effect of the patch I'm reverting was to fix the code formatting in an existing test file! |
|
OK, now I understand what that error message meant! The problem is that the Fuchsia buildbot is using cmake 3.22.1 (from Ubuntu 22.04), and the form of |
Reverts #161546
One of the buildbots reported a cmake error I don't understand, and which I didn't get in my own test builds:
My best guess is that the thing I did in
CheckAssemblerFlag.cmakeonly works on some versions of cmake. But I don't understand the problem well enough to fix it quickly, so I'm reverting the whole patch and will reland it later.