[llvm-commits] CVS: llvm/lib/Target/X86/FloatingPoint.cpp InstSelectSimple.cpp X86InstrInfo.td X86SimpInstrSelector.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 10 23:55:01 PDT 2004
Changes in directory llvm/lib/Target/X86:
FloatingPoint.cpp updated: 1.35 -> 1.36
InstSelectSimple.cpp updated: 1.259 -> 1.260
X86InstrInfo.td updated: 1.78 -> 1.79
X86SimpInstrSelector.cpp updated: 1.2 -> 1.3
---
Log message:
Now that compare instructions aren't lumped in with the other twoargfp instructions,
we can get rid of the FpUCOM/FpUCOMi pseudo instructions, which makes stuff simpler
and faster.
---
Diffs of the changes: (+9 -15)
Index: llvm/lib/Target/X86/FloatingPoint.cpp
diff -u llvm/lib/Target/X86/FloatingPoint.cpp:1.35 llvm/lib/Target/X86/FloatingPoint.cpp:1.36
--- llvm/lib/Target/X86/FloatingPoint.cpp:1.35 Thu Jun 10 23:41:24 2004
+++ llvm/lib/Target/X86/FloatingPoint.cpp Thu Jun 10 23:49:02 2004
@@ -614,7 +614,7 @@
delete MI; // Remove the old instruction
}
-/// handleCompareFP - Handle FpUCOM and FpUCOMI instructions, which have two FP
+/// handleCompareFP - Handle FUCOM and FUCOMI instructions, which have two FP
/// register arguments and no explicit destinations.
///
void FPS::handleCompareFP(MachineBasicBlock::iterator &I) {
@@ -623,7 +623,7 @@
MachineInstr *MI = I;
unsigned NumOperands = MI->getNumOperands();
- assert(NumOperands == 2 && "Illegal FpUCOM* instruction!");
+ assert(NumOperands == 2 && "Illegal FUCOM* instruction!");
unsigned Op0 = getFPReg(MI->getOperand(NumOperands-2));
unsigned Op1 = getFPReg(MI->getOperand(NumOperands-1));
bool KillsOp0 = false, KillsOp1 = false;
@@ -638,15 +638,9 @@
// anywhere.
moveToTop(Op0, I);
- // Replace the old instruction with a new instruction
- MBB->remove(I++);
- unsigned Opcode = MI->getOpcode() == X86::FpUCOM ? X86::FUCOMr : X86::FUCOMIr;
- I = BuildMI(*MBB, I, Opcode, 1).addReg(getSTReg(Op1));
-
// If any of the operands are killed by this instruction, free them.
if (KillsOp0) freeStackSlotAfter(I, Op0);
if (KillsOp1 && Op0 != Op1) freeStackSlotAfter(I, Op1);
- delete MI; // Remove the old instruction
}
/// handleCondMovFP - Handle two address conditional move instructions. These
Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.259 llvm/lib/Target/X86/InstSelectSimple.cpp:1.260
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.259 Thu Jun 10 23:31:10 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp Thu Jun 10 23:49:02 2004
@@ -1005,11 +1005,11 @@
break;
case cFP:
if (0) { // for processors prior to the P6
- BuildMI(*MBB, IP, X86::FpUCOM, 2).addReg(Op0r).addReg(Op1r);
+ BuildMI(*MBB, IP, X86::FUCOMr, 2).addReg(Op0r).addReg(Op1r);
BuildMI(*MBB, IP, X86::FNSTSW8r, 0);
BuildMI(*MBB, IP, X86::SAHF, 1);
} else {
- BuildMI(*MBB, IP, X86::FpUCOMI, 2).addReg(Op0r).addReg(Op1r);
+ BuildMI(*MBB, IP, X86::FUCOMIr, 2).addReg(Op0r).addReg(Op1r);
}
break;
@@ -1701,11 +1701,11 @@
case Intrinsic::isnan:
TmpReg1 = getReg(CI.getOperand(1));
if (0) { // for processors prior to the P6
- BuildMI(BB, X86::FpUCOM, 2).addReg(TmpReg1).addReg(TmpReg1);
+ BuildMI(BB, X86::FUCOMr, 2).addReg(TmpReg1).addReg(TmpReg1);
BuildMI(BB, X86::FNSTSW8r, 0);
BuildMI(BB, X86::SAHF, 1);
} else {
- BuildMI(BB, X86::FpUCOMI, 2).addReg(TmpReg1).addReg(TmpReg1);
+ BuildMI(BB, X86::FUCOMIr, 2).addReg(TmpReg1).addReg(TmpReg1);
}
TmpReg2 = getReg(CI);
BuildMI(BB, X86::SETPr, 0, TmpReg2);
Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.78 llvm/lib/Target/X86/X86InstrInfo.td:1.79
--- llvm/lib/Target/X86/X86InstrInfo.td:1.78 Thu Jun 10 23:41:24 2004
+++ llvm/lib/Target/X86/X86InstrInfo.td Thu Jun 10 23:49:02 2004
@@ -863,12 +863,12 @@
def FDIVRPrST0 : FPrST0PInst<"fdivrp", 0xF0>; // ST(i) = ST(0) / ST(i), pop
// Floating point compares
-def FUCOMr : I<"fucom" , 0xE0, AddRegFrm>, DD, Imp<[ST0],[]>; // FPSW = compare ST(0) with ST(i)
+def FUCOMr : FPI<"fucom", 0xE0, AddRegFrm, CompareFP>, DD, Imp<[ST0],[]>; // FPSW = compare ST(0) with ST(i)
def FUCOMPr : I<"fucomp" , 0xE8, AddRegFrm>, DD, Imp<[ST0],[]>; // FPSW = compare ST(0) with ST(i), pop
def FUCOMPPr : I<"fucompp", 0xE9, RawFrm >, DA, Imp<[ST0],[]>; // compare ST(0) with ST(1), pop, pop
let printImplicitUsesBefore = 1 in {
- def FUCOMIr : I<"fucomi" , 0xE8, AddRegFrm>, DB, Imp<[ST0],[]>; // CC = compare ST(0) with ST(i)
+ def FUCOMIr : FPI<"fucomi", 0xE8, AddRegFrm, CompareFP>, DB, Imp<[ST0],[]>; // CC = compare ST(0) with ST(i)
def FUCOMIPr : I<"fucomip", 0xE8, AddRegFrm>, DF, Imp<[ST0],[]>; // CC = compare ST(0) with ST(i), pop
}
Index: llvm/lib/Target/X86/X86SimpInstrSelector.cpp
diff -u llvm/lib/Target/X86/X86SimpInstrSelector.cpp:1.2 llvm/lib/Target/X86/X86SimpInstrSelector.cpp:1.3
--- llvm/lib/Target/X86/X86SimpInstrSelector.cpp:1.2 Wed Jun 2 00:55:25 2004
+++ llvm/lib/Target/X86/X86SimpInstrSelector.cpp Thu Jun 10 23:49:02 2004
@@ -845,7 +845,7 @@
BuildMI(*MBB, IP, X86::CMP32rr, 2).addReg(Op0r).addReg(Op1r);
break;
case cFP:
- BuildMI(*MBB, IP, X86::FpUCOM, 2).addReg(Op0r).addReg(Op1r);
+ BuildMI(*MBB, IP, X86::FUCOMr, 2).addReg(Op0r).addReg(Op1r);
BuildMI(*MBB, IP, X86::FNSTSW8r, 0);
BuildMI(*MBB, IP, X86::SAHF, 1);
break;
More information about the llvm-commits
mailing list