This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Allow selecting hard-float ABI in integer-only MVE.
ClosedPublic

Authored by simon_tatham on Jan 27 2023, 3:45 AM.

Details

Summary

Armv8.1-M can be configured to support the integer subset of the MVE
vector instructions, and no floating point. In that situation, the FP
and vector registers still exist, and so do the load, store and move
instructions that transfer data in and out of them. So there's no
reason the hard floating point ABI can't be supported, and you might
reasonably want to use it, for the sake of intrinsics-based code
passing explicit MVE vector types between functions.

But the selection of the hard float ABI in the backend was gated on
Subtarget->hasVFP2Base(), which is false in the case of integer MVE
and no FP.

As a result, you'd silently get the soft float ABI even if you
deliberately tried to select it, e.g. with clang options such as
--target=arm-none-eabi -mfloat-abi=hard -march=armv8.1m.main+nofp+mve

The hard float ABI should have been gated on the weaker condition
Subtarget->hasFPRegs(), because the only requirement for being able to
pass arguments in the FP registers is that the registers themselves
should exist.

I haven't added a new test, because changing the existing
CodeGen/Thumb2/float-ops.ll test seemed sufficient. But I've added a
comment explaining why the results are expected to be what they are.

Diff Detail

Event Timeline

simon_tatham created this revision.Jan 27 2023, 3:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 3:45 AM
simon_tatham requested review of this revision.Jan 27 2023, 3:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 3:46 AM
simon_tatham retitled this revision from [ARM] Allow selecting the hard float ABI in integer-only MVE. r=MaskRay,dmgreen,efriedma,john.brawn,lenary,ostannard to [ARM] Allow selecting the hard float ABI in integer-only MVE..Jan 27 2023, 3:46 AM
lenary accepted this revision.Jan 27 2023, 5:44 AM

From your description this sounds right, and GCC matches the new behaviour as far as I can see: https://godbolt.org/z/f1M41dhvv

Please can you add a release note when you land this, as this is a breaking change?

This revision is now accepted and ready to land.Jan 27 2023, 5:44 AM
simon_tatham retitled this revision from [ARM] Allow selecting the hard float ABI in integer-only MVE. to [ARM] Allow selecting hard-float ABI in integer-only MVE..
simon_tatham edited the summary of this revision. (Show Details)

Added draft release notes, and an extra comment in the modified test file.

Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 5:55 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision was landed with ongoing or failed builds.Feb 1 2023, 1:05 AM
This revision was automatically updated to reflect the committed changes.