This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Properly implement widening for TB(N)Z
ClosedPublic

Authored by paquette on Feb 11 2020, 11:09 AM.

Details

Summary

When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.

Add a general-purpose widening helper (widenIfNeeded), which emits the correct SUBREG_TO_REG instruction based off of a desired size and add a testcase.

Also remove some asserts which are technically incorrect in emitTestBit.

  • p0 doesn't count as a scalar type, so we need to check !Ty.isVector() instead
  • Whenever we have a s1, the Size/Bit checks are too conservative, so just remove them

Replace these asserts with less conservative ones where applicable.

Diff Detail

Event Timeline

paquette created this revision.Feb 11 2020, 11:09 AM

(I wasn't aware that Herald added Renato as a reviewer, whoops? Thought that was a typo on my end or something.)

aemerson accepted this revision.Feb 11 2020, 3:06 PM

LGTM with nits.

llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
5159

I think this should be named something more specific, like widenGPRBankRegIfNeeded or similar, because it's not a generic widening.

5202

This can be SubRegToReg.getReg(0);

This revision is now accepted and ready to land.Feb 11 2020, 3:06 PM
This revision was automatically updated to reflect the committed changes.