This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Moving CMSE handling of half arguments and return to the backend
ClosedPublic

Authored by pratlucas on Jun 8 2020, 1:48 PM.

Details

Summary

As half-precision floating point arguments and returns were previously
coerced to either float or int32 by clang's codegen, the CMSE handling
of those was also performed in clang's side by zeroing the unused MSBs
of the coercer values.

This patch moves this handling to the backend's calling convention
lowering, making sure the high bits of the registers used by
half-precision arguments and returns are zeroed.

Diff Detail

Event Timeline

pratlucas created this revision.Jun 8 2020, 1:48 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 8 2020, 1:48 PM
pratlucas updated this revision to Diff 269452.Jun 9 2020, 2:22 AM

Moving the clean-up of the Clang-side handling to a separate patch.

Is this expected to work for the soft-float calling convention, or is clang still passing half-precision values as integer types for that? If the former, then this needs some tests for that case.

llvm/lib/Target/ARM/ARMISelLowering.cpp
2280

Could this be done more efficiently by changing the ANY_EXTEND above to a ZERO_EXTEND when this is a CMSE call?

2956

Again, could this be done by using ZERO_EXTEND instead of ANY_EXTEND for CMSE entry functions?

llvm/test/CodeGen/ARM/cmse-clear-float-hard.ll
812

The function attributes ("cmse_nonsecure_entry" nounwind in this case) can be placed here (replacing the #10) to make the tests easier to read.

pratlucas updated this revision to Diff 270149.Jun 11 2020, 8:21 AM

Rebasing and simplifying function attributes on test.

pratlucas updated this revision to Diff 270160.Jun 11 2020, 8:45 AM

Addressing review comment.

pratlucas marked 4 inline comments as done.Jun 11 2020, 8:48 AM
pratlucas added inline comments.
llvm/lib/Target/ARM/ARMISelLowering.cpp
2280

Now that the fp16 type convertion on D75169 was updated to use VMOVhr/VMOVrh, I've updated this patch to only use and AND masking when the argument are extended by getCopyToParts/getCopyFromParts prior to the calling convention lowering.

pratlucas marked an inline comment as done.Jun 11 2020, 8:49 AM
This revision is now accepted and ready to land.Jun 12 2020, 1:48 AM
This revision was automatically updated to reflect the committed changes.