This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Select FCMPSri/FCMPDri when comparing against 0.0
ClosedPublic

Authored by paquette on May 28 2019, 11:25 AM.

Details

Summary

Add support for selecting FCMPSri and FCMPDri when comparing against 0.0, and factor out opcode selection for G_FCMP into its own function.

Add a test to show that we don't do this with other immediates.

Diff Detail

Repository
rL LLVM

Event Timeline

paquette created this revision.May 28 2019, 11:25 AM
aemerson accepted this revision.May 28 2019, 1:48 PM

LGTM. Can make a small change to make things a bit more concise but not very important.

llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
751 ↗(On Diff #201729)

Not a big deal, but you can turn this logic into a small lookup table, like:

unsigned OpSize = MRI.getType(I.getOperand(2).getReg()).getSizeInBits();
unsigned CmpOpcTbl[2][2] = {{FCmpSri, FCmpDri}, {FCmpSrr, FCmpDrr}};
return CmpOpcTbl[ShouldUseImm][OpSize == 64];
This revision is now accepted and ready to land.May 28 2019, 1:48 PM
This revision was automatically updated to reflect the committed changes.