This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Fold in G_ANYEXT/G_ZEXT into TB(N)Z
ClosedPublic

Authored by paquette on Jan 29 2020, 4:21 PM.

Details

Summary

This is similar to the code in getTestBitOperand in AArch64ISelLowering. Instead of implementing all of the TB(N)Z optimizations at once, this patch implements the simplest case first. The way that this is set up should make it fairly easy to add the rest as we go along.

The idea here is that after determining that we can use a TB(N)Z, we can continue looking through instructions and perform further folding.

In this case, when we have a G_ZEXT or G_ANYEXT where the extended bits are not used, we can fold it into the TB(N)Z.

Diff Detail

Event Timeline

paquette created this revision.Jan 29 2020, 4:21 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 29 2020, 11:31 PM
This revision was automatically updated to reflect the committed changes.
aemerson reopened this revision.Jan 30 2020, 12:00 AM

Oops, linked to the wrong review in the commit message and ended up auto-closing this by mistake.

Could you re-upload your patch so it can be reviewed?

paquette updated this revision to Diff 241516.Jan 30 2020, 10:54 AM

Restore original patch

aemerson added inline comments.Jan 30 2020, 11:09 AM
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
995

This can be a while() instead?

paquette updated this revision to Diff 241566.Jan 30 2020, 1:27 PM

Use while loop and add assert that the register is valid.

aemerson accepted this revision.Jan 30 2020, 1:50 PM

LGTM.

This revision is now accepted and ready to land.Jan 30 2020, 1:50 PM
This revision was automatically updated to reflect the committed changes.