[PATCH] D17749: [PPC64] Use mfocrf in prologue when we only need to save 1 nonvolatile CR field

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 03:24:20 PST 2016


cycheng added inline comments.

================
Comment at: lib/Target/PowerPC/PPCFrameLowering.cpp:845
@@ -844,3 +844,3 @@
     MachineInstrBuilder MIB =
       BuildMI(MBB, MBBI, dl, TII.get(PPC::MFCR8), TempReg);
     for (unsigned i = 0, e = MustSaveCRs.size(); i != e; ++i)
----------------
nemanjai wrote:
> Do we not want to do this if we're serializing the CR/LR save sequences (i.e. when the prologue has a single scratch register available)? Perhaps define MfcrOpcode above and use it here as well.
Thanks : ) I fixed it.

By the way, I am curious about in which circumstance TempReg == ScratchReg? Because of shrink-wrapping?

================
Comment at: test/CodeGen/PowerPC/crsave.ll:24
@@ -23,3 +23,3 @@
 ; PPC64: .cfi_startproc
-; PPC64: mfcr 12
+; PPC64: mfocrf 12
 ; PPC64: stw 12, 8(1)
----------------
nemanjai wrote:
> Do we not know which CR field we need to save here?
Yes we know it.


http://reviews.llvm.org/D17749





More information about the llvm-commits mailing list