-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Fix extendhfxf2 test #117665
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
Fix extendhfxf2 test #117665
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fixes - I realize I didn't actually review the test properly.
7b66a3b
to
5b8b595
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit otherwise LGTM. Thanks!
int test_extendhfxf2(TYPE_FP16 a, xf_float expected) { | ||
xf_float x = __extendhfxf2(a); | ||
uint16_t a_rep = toRep16(a); | ||
int ret = compareResultF80(x, expected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this expects hi and lo. I'll have to change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f80 functions in fp_test are only for x86_64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes that should be relaxed to just be gated on fp80 support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e. change the if in fp_test.h to just HAS_80_BIT_LONG_DOUBLE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the test exclusive for x86_64. Would __uint128_t
be available on i386?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may or may not - but we shouldn't need it for this. I'll take care of that as a follo-up.
746db3b
to
0a9032f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
This change does fix tests on x86_64 mingw, but it still fails on i686 mingw, and it also breaks a number of previously working tests there - have a look: https://github.com/mstorsjo/llvm-project/actions/runs/12026429539/job/33525399943 You can try this out for yourself - cherrypick mstorsjo@gha-mingw-compiler-rt onto your branch and push to your fork, and it will run these tests in your own github fork (no PR needed even). |
@@ -230,7 +230,7 @@ static inline double makeQNaN64(void) | |||
return fromRep64(0x7ff8000000000000UL); | |||
} | |||
|
|||
#if __LDBL_MANT_DIG__ == 64 && defined(__x86_64__) | |||
#if HAS_80_BIT_LONG_DOUBLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, we specifically checked for x86_64
here, but HAS_80_BIT_LONG_DOUBLE
also is true on i686 mingw, so this will start executing these codepaths on i686 now as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, https://github.com/mstorsjo/llvm-project/actions/runs/12026429539/job/33525399943 this suggests uint128t is not defined, thus this should be only enabled for x86_64.
Alternatively we could check if __uint128t is available with check_c_source_compiles and add another flag like we do here
check_c_source_compiles("_Float16 foo(_Float16 x) { return x; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I also tested with an addition like this: mstorsjo@de5ad3a
That unbreaks the other unrelated tests, but this new test still is failing: https://github.com/mstorsjo/llvm-project/actions/runs/12026756315/job/33526363616
# | D:\a\llvm-project\llvm-project\compiler-rt\test\builtins\Unit\extendhfxf2_test.c:16:13: error: call to undeclared function 'compareResultF80'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
# | 16 | int ret = compareResultF80(x, expectedHi, expectedLo);
# | | ^
So a similar condition would need to be added back to the condition within the actual test here as well.
Things are similar on Solaris/amd64:
AFAICS the failures are all for the same reason:
|
I've added the necessary checks to the test case now. |
Thanks! This version works for the mingw tests on i686 and x86_64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, fp_test.h guards can be cleaned up later.
Fix changes in #113897
cc @arichardson