This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Optimize compares fed by ANDISo
ClosedPublic

Authored by nemanjai on Aug 28 2018, 6:25 AM.

Details

Summary

Both ANDIo and ANDISo (and the 64-bit versions) are record-form instructions. When optimizing compares, we handle the former in order to eliminate the compare instruction but not the latter. This patch just adds the latter to the set of instructions we optimize.
The reason these instructions need to be handled separately is that they are not part of the RecFormRel map (since they don't have a non-record-form). The missing "and-immediate-shifted" is just an oversight in the initial implementation.

Diff Detail

Repository
rL LLVM

Event Timeline

nemanjai created this revision.Aug 28 2018, 6:25 AM

@inouehrs Can you please review/comment/approve this as I've separated this out per your request.

inouehrs accepted this revision.Aug 31 2018, 5:12 AM

LGTM with nitpicking.

I feel that the current test case is somewhat fragile for minor change in inst. scheduling or register allocation.
Checking there is no cmpdi between andis. and isel may be enough.

This revision is now accepted and ready to land.Aug 31 2018, 5:12 AM

LGTM with nitpicking.

I feel that the current test case is somewhat fragile for minor change in inst. scheduling or register allocation.
Checking there is no cmpdi between andis. and isel may be enough.

Yeah, I usually don't like to modify the checks produced by the automated tool. However, I think your suggestion is reasonable - having the andis. and no cmp before its use should sufficiently test this patch.

This revision was automatically updated to reflect the committed changes.