This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][AArch64] Add isel support for FP16 vector @llvm.ceil
ClosedPublic

Authored by paquette on Jan 14 2019, 2:38 PM.

Details

Reviewers
aemerson
Summary

This patch adds support for vector @llvm.ceil intrinsics when full 16 bit floating point support isn't available.

To do this, this patch...

  • Implements basic isel for G_UNMERGE_VALUES
  • Teaches the legalizer about 16 bit floats
  • Teaches AArch64RegisterBankInfo to respect floating point registers on G_BUILD_VECTOR and G_UNMERGE_VALUES
  • Teaches selectCopy about 16-bit floating point vectors

It also adds

  • A legalizer test for the 16-bit vector ceil which verifies that we create a G_UNMERGE_VALUES and G_BUILD_VECTOR when full fp16 isn't supported
  • An instruction selection test which makes sure we lower to G_FCEIL when full fp16 is supported
  • A test for selecting G_UNMERGE_VALUES

And also updates arm64-vfloatintrinsics.ll to show that the new ceiling types work as expected.

Diff Detail

Event Timeline

paquette created this revision.Jan 14 2019, 2:38 PM
paquette updated this revision to Diff 182636.Jan 18 2019, 4:29 PM

Updated based off some conversation with Amara offline.

  • Taught BUILD_VECTOR about unpacked vectors, where it could previously screw up in the old version of the patch
  • Added some more validation to selectCopy
  • Generalized the subregister insert case in selectCopy
  • Added a getMinClassForRegBank convenience function to handle the cross-bank copies in selectCopy
arsenm added a subscriber: arsenm.Jan 18 2019, 5:48 PM
arsenm added inline comments.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
1339–1340

You can just add this as a case once I commit D56863

paquette updated this revision to Diff 183127.Jan 23 2019, 10:30 AM

Updated to stay in sync with @arsenm's changes to fewerElementsVector.

paquette updated this revision to Diff 183130.Jan 23 2019, 10:38 AM

Accidentally dropped some tests in previous update; brought them back

aemerson accepted this revision.Jan 24 2019, 11:50 AM

LGTM with some changes.

lib/Target/AArch64/AArch64InstructionSelector.cpp
523

We should have an assert here for SubregRC != null..

1789

This debug comment's not quite accurate, as G_UNMERGE can also be used to split a large scalar into smaller scalar components. I also think we should check that the source operand is also on the FPR register bank to avoid accidentally trying to handle weird fpr = unmerge(gpr) cases.

1836

Use SmallVector to avoid heap allocs?

lib/Target/AArch64/AArch64RegisterBankInfo.cpp
674

clarify s/first operand/first source operand

682

clarify s/defined the BUILD_VECTOR/defined the source operand reg

This revision is now accepted and ready to land.Jan 24 2019, 11:50 AM
paquette closed this revision.Jan 24 2019, 2:01 PM
paquette marked 4 inline comments as done.

Thanks! Committed in r352113.