File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -541,10 +541,12 @@ bool PPCMIPeephole::simplifyCode(void) {
541
541
if (!P1 || !P2)
542
542
break ;
543
543
544
- // Remove the passed FRSP instruction if it only feeds this MI and
545
- // set any uses of that FRSP (in this MI) to the source of the FRSP.
544
+ // Remove the passed FRSP/XSRSP instruction if it only feeds this MI
545
+ // and set any uses of that FRSP/XSRSP (in this MI) to the source of
546
+ // the FRSP/XSRSP.
546
547
auto removeFRSPIfPossible = [&](MachineInstr *RoundInstr) {
547
- if (RoundInstr->getOpcode () == PPC::FRSP &&
548
+ unsigned Opc = RoundInstr->getOpcode ();
549
+ if ((Opc == PPC::FRSP || Opc == PPC::XSRSP) &&
548
550
MRI->hasOneNonDBGUse (RoundInstr->getOperand (0 ).getReg ())) {
549
551
Simplified = true ;
550
552
Register ConvReg1 = RoundInstr->getOperand (1 ).getReg ();
@@ -554,7 +556,7 @@ bool PPCMIPeephole::simplifyCode(void) {
554
556
if (Use.getOperand (i).isReg () &&
555
557
Use.getOperand (i).getReg () == FRSPDefines)
556
558
Use.getOperand (i).setReg (ConvReg1);
557
- LLVM_DEBUG (dbgs () << " Removing redundant FRSP:\n " );
559
+ LLVM_DEBUG (dbgs () << " Removing redundant FRSP/XSRSP :\n " );
558
560
LLVM_DEBUG (RoundInstr->dump ());
559
561
LLVM_DEBUG (dbgs () << " As it feeds instruction:\n " );
560
562
LLVM_DEBUG (MI.dump ());
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ body: |
56
56
# CHECK-LABEL: remove_xsrsp
57
57
# CHECK: sldi 4, 4, 2
58
58
# CHECK-NEXT: lfsux 0, 3, 4
59
- # CHECK-NEXT : xsrsp 0, 0
59
+ # CHECK-NOT : xsrsp
60
60
# CHECK-NEXT: lfs 1, 8(3)
61
61
# CHECK-NEXT: xxmrghd 0, 1, 0
62
62
# CHECK-NEXT: xvcvdpsp 34, 0
You can’t perform that action at this time.
0 commit comments