Skip to content

ARM: Remove redundant or buggy config of __aeabi_d2h #152126

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 1 commit into from
Aug 5, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Aug 5, 2025

This was set if TT.isTargetAEABI(). This was previously set above
if TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() || TT.isAndroid()).

So this could differ based on a manually specified -target-abi flag due
to the isAAPCS_ABI part of the original condition. I'm guessing
these should be consistent, so either this second group of setLibcallImpl
calls should have been guarded by the isAAPCS_ABI check, or the first
condition should remove it.

There doesn't appear to be any meaningful test coverage using the
manually specified ABI option, so #152108 tries to remove it

This was set if `TT.isTargetAEABI()`. This was previously set above
if `TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() ||
                         TT.isTargetMuslAEABI() || TT.isAndroid())`.

So this could differ based on a manually specified -target-abi flag due
to the `isAAPCS_ABI` part of the original condition. I'm guessing
these should be consistent, so either this second group of setLibcallImpl
calls should have been guarded by the `isAAPCS_ABI` check, or the first
condition should remove it.

There doesn't appear to be any meaningful test coverage using the
manually specified ABI option, so #152108 tries to remove it
@arsenm arsenm added the backend:ARM label Aug 5, 2025 — with Graphite App
Copy link
Contributor Author

arsenm commented Aug 5, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Aug 5, 2025

@llvm/pr-subscribers-backend-arm

Author: Matt Arsenault (arsenm)

Changes

This was set if TT.isTargetAEABI(). This was previously set above
if TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() || TT.isTargetMuslAEABI() || TT.isAndroid()).

So this could differ based on a manually specified -target-abi flag due
to the isAAPCS_ABI part of the original condition. I'm guessing
these should be consistent, so either this second group of setLibcallImpl
calls should have been guarded by the isAAPCS_ABI check, or the first
condition should remove it.

There doesn't appear to be any meaningful test coverage using the
manually specified ABI option, so #152108 tries to remove it


Full diff: https://github.com/llvm/llvm-project/pull/152126.diff

1 Files Affected:

  • (modified) llvm/lib/Target/ARM/ARMISelLowering.cpp (-1)
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 7f8b4460bb814..18766c8c6befa 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -737,7 +737,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
       const RTLIB::LibcallImpl Impl;
     } LibraryCalls[] = {
         {RTLIB::FPROUND_F32_F16, RTLIB::__aeabi_f2h},
-        {RTLIB::FPROUND_F64_F16, RTLIB::__aeabi_d2h},
         {RTLIB::FPEXT_F16_F32, RTLIB::__aeabi_h2f},
     };
 

@arsenm arsenm marked this pull request as ready for review August 5, 2025 11:25
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I think that the other case should be changed. The GNU EABI should use the GNU variant. The AEABI implementation might be compatible with APCS, but definitely is compatible with AAPCS.

@arsenm
Copy link
Contributor Author

arsenm commented Aug 5, 2025

I think that the other case should be changed. The GNU EABI should use the GNU variant. The AEABI implementation might be compatible with APCS, but definitely is compatible with AAPCS.

I'm not sure exactly what you're saying; I'm not trying to change the used call or behavior, only try to make the exact conditions where the calls are currently used more obvious

@rengolin
Copy link
Member

rengolin commented Aug 5, 2025

This looks like a leftover of some other partial change a long time ago. I've touched that area a long time ago, when gnueabi and eabi didn't have super clear distinction between each other.

How can we test this?

Copy link
Collaborator

@efriedma-quic efriedma-quic left a comment

Choose a reason for hiding this comment

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

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120897 for a summary of the history here; it's very messy. Really, we should be calling __gnu_d2h_ieee on targets using libgcc because __aeabi_d2h doesn't exist, but the patch (https://reviews.llvm.org/D94557) never got merged.

I think we have sufficient test coverage in llvm/test/CodeGen/ARM/fp16.ll, to detect if anyone accidentally makes further changes here.

This seems fine for now; if someone wants to revive D94557, they can do it once all the TableGen changes are in.

LGTM

@arsenm arsenm merged commit d44754c into main Aug 5, 2025
13 checks passed
@arsenm arsenm deleted the users/arsenm/arm/remove-redundant-config-__aeabi_d2h branch August 5, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants