[PATCH] D62044: [PowerPC] Remove CRBits Copy Of Unset/set CBit

Victor Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 16:04:30 PDT 2019


NeHuang created this revision.
NeHuang added reviewers: hfinkel, nemanjai, lei, stefanp, saghir.
NeHuang added a project: LLVM.
Herald added subscribers: llvm-commits, jsji, kbarton, hiraditya.

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


https://reviews.llvm.org/D62044

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.td
  llvm/test/CodeGen/PowerPC/remove-copy-crunsetcrbit.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62044.199925.patch
Type: text/x-patch
Size: 7890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/44711149/attachment.bin>


More information about the llvm-commits mailing list