Skip to content

[builtins][AArch32] Fix __gnu_* functions #137638

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

Merged
merged 4 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler-rt/lib/builtins/extendhfsf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ COMPILER_RT_ABI NOINLINE float __extendhfsf2(src_t a) {
return __extendXfYf2__(a);
}

COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default for all non-Arm targets, as written this will disappear from all but the __ARM_EABI__ targets.

This is probably fine in practice as at least recent versions of clang will not call __gnu_h2f_ieee and __gnu_f2h_ieee for non Arm targets. It will be worth a #else for #if defined(__ARM_EABI__) with this line just in case a new compiler-rt is used with an old object with such a call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it is below


#if defined(__ARM_EABI__)
#if defined(COMPILER_RT_ARMHF_TARGET)
AEABI_RTABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
AEABI_RTABI float __aeabi_h2f(src_t a) { return __extendhfsf2(a); }
#else
COMPILER_RT_ALIAS(__extendhfsf2, __gnu_h2f_ieee)
COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f)
#endif
COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
#endif
4 changes: 3 additions & 1 deletion compiler-rt/lib/builtins/truncsfhf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) {
return __truncXfYf2__(a);
}

COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }

#if defined(__ARM_EABI__)
#if defined(COMPILER_RT_ARMHF_TARGET)
AEABI_RTABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); }
#else
COMPILER_RT_ALIAS(__truncsfhf2, __gnu_f2h_ieee)
COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h)
#endif
COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
#endif