-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt] Make Arm builtins aware of endianness in VMOVs #123204
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 patch makes `__aeabi_dcmp` family of functions aware of endianness. Before this patch, the functions' definitions assumed little endian, which made any program compiler for big endian incorrect.
This looks good to me. Looking at https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/arm/softfloat-alias.list there are several functions that may also use the same trick. At least some of these also use Would you be able to check to see if these can be called by a big-endian clang? I expect some of them may not alias to aeabi functions, although it may be possible for the compiler to output these helper functions with some other command-line options. |
@smithp35 For simplicity I've decided to add support of big endianness to all Arm builtins that have the same pattern ( |
✅ 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.
I like the approach. I think I've spotted one typo where a core register has been used rather than a double.
@@ -24,7 +24,7 @@ DEFINE_COMPILERRT_FUNCTION(__floatunssidfvfp) | |||
#else | |||
vmov s15, r0 // move int to float register s15 | |||
vcvt.f64.u32 d7, s15 // convert 32-bit int in s15 to double in d7 | |||
vmov r0, r1, d7 // move d7 to result register pair r0/r1 | |||
VMOV_FROM_DOUBLE(r0, r1, r7) // move d7 to result register pair r0/r1 |
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.
Did you mean vmov r0, r1, d7 here?
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. Fixed.
The typo didn't cause any failures in the picolibc tests. One indication that these parts here are undertested.
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 looks like the compiler-rt test suite would have caught this if it were built and run on exactly the right target with test/floatunssidfvfp_test.c
It looks like the little-endian side should be tested via the clang-armv7-2stage https://lab.llvm.org/buildbot/#/builders/79 as that will run the compiler-rt unit tests directly.
Testing big-endian is more difficult as we'd likely need to find a very old linux big-endian eabihf sysroot and use qemu-arm as our test executor.
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 for the update. Please leave a day or so for other reviewers to comment.
This patch makes Arm builtins aware of endianness in VMOVs.
Before this patch, the functions' definitions assumed little endian, which made any program compiler for big endian incorrect.