Page MenuHomePhabricator

[PowerPC] Remove CRBits Copy Of Unset/set CBit
ClosedPublic

Authored by NeHuang on May 16 2019, 4:04 PM.

Details

Summary

For the situation, where we generate the following code:

# %bb.0:
        crxor 8, 8, 8
        < Some instructions>
.LBB0_1:
        < Some instructions>
        cror 1, 8, 8

cror (COPY of CRbit) depends on the result of the crxor instruction. CR8 is known to be zero as crxor is equivalent to CRUNSET. We can simply use crxor 1, 1, 1 instead to zero out CR1, which does not have any dependency on any previous instruction.

This patch will optimize it to:

# %bb.0:
        < Some instructions>
.LBB0_1:
        < Some instructions>
        cror 1, 1, 1

Diff Detail

Repository
rL LLVM

Event Timeline

NeHuang created this revision.May 16 2019, 4:04 PM
hfinkel accepted this revision.May 16 2019, 6:55 PM

LGTM.

This revision is now accepted and ready to land.May 16 2019, 6:55 PM
NeHuang updated this revision to Diff 200798.EditedMay 22 2019, 11:29 AM

After re-basing the patch with latest master ToT, there is a LIT failure for the KnowCRBitSpill.ll. As per discussed and reviewed in the meeting, the CRSET test case behavior change is as expected. The test case check logic is updated accordingly.

Merged with master commit "45330fee4c2053c03e4446ce2a4da3769ca7a5a7" and confirmed build, LIT, LNT and bootstrap tests passed.

hfinkel accepted this revision.May 22 2019, 5:39 PM

After re-basing the patch with latest master ToT, there is a LIT failure for the KnowCRBitSpill.ll. As per discussed and reviewed in the meeting, the CRSET test case behavior change is as expected. The test case check logic is updated accordingly.

Merged with master commit "45330fee4c2053c03e4446ce2a4da3769ca7a5a7" and confirmed build, LIT, LNT and bootstrap tests passed.

Sounds good. Please go ahead.

This revision was automatically updated to reflect the committed changes.