This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GISel] Additional FPTrunc vector lowering
ClosedPublic

Authored by dmgreen on Jul 14 2023, 10:02 AM.

Details

Summary

I was attempting to add llvm.reduce.fminimum/fmaximum support for GlobalISel. In the process I noticed that llvm.reduce.fmin/fmax was missing, and could do with being added first. That led on to adding additional vector support for minnum/maxnum, which in turn led to needing to handle fptrunc and fpext for some of the fp16 types. So this patch extends the vector handling for fptrunc, adding support for f16 types which are clamped to 4 elements, and scalarizing the rest.

I went round in circles a little with how smaller than legal vectors should be handled, but this seems simple and seems to work, if not always optimally yet.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 14 2023, 10:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 10:02 AM
dmgreen requested review of this revision.Jul 14 2023, 10:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 10:02 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm accepted this revision.Jul 14 2023, 10:19 AM
arsenm added inline comments.
llvm/test/CodeGen/AArch64/fptrunc.ll
3

should use explicit =0/=1 so it doesn't break when the default switches

36

v3 tests often find interesting broken things

This revision is now accepted and ready to land.Jul 14 2023, 10:19 AM
dmgreen added inline comments.
llvm/test/CodeGen/AArch64/fptrunc.ll
36

Thanks. Will do. I was focusing on power-2 types with power-2 vector sizes, but it makes sense to include some non-power-2 vectors too.

This revision was landed with ongoing or failed builds.Jul 18 2023, 10:52 AM
This revision was automatically updated to reflect the committed changes.