[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp X86InstrInfo.td
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 2 13:32:02 PST 2004
Changes in directory llvm/lib/Target/X86:
InstSelectSimple.cpp updated: 1.151 -> 1.152
X86InstrInfo.td updated: 1.15 -> 1.16
---
Log message:
Generate the fchs instruction to negate a floating point number
---
Diffs of the changes: (+15 -1)
Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.151 llvm/lib/Target/X86/InstSelectSimple.cpp:1.152
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.151 Mon Feb 2 12:56:30 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp Mon Feb 2 13:31:38 2004
@@ -1227,7 +1227,13 @@
return;
}
}
- }
+ } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op0))
+ if (CFP->isExactlyValue(-0.0)) {
+ // -0.0 - X === -X
+ unsigned op1Reg = getReg(Op1, MBB, IP);
+ BMI(MBB, IP, X86::FCHS, 1, DestReg).addReg(op1Reg);
+ return;
+ }
if (!isa<ConstantInt>(Op1) || Class == cLong) {
static const unsigned OpcodeTab[][4] = {
Index: llvm/lib/Target/X86/X86InstrInfo.td
diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.15 llvm/lib/Target/X86/X86InstrInfo.td:1.16
--- llvm/lib/Target/X86/X86InstrInfo.td:1.15 Sat Dec 20 10:22:59 2003
+++ llvm/lib/Target/X86/X86InstrInfo.td Mon Feb 2 13:31:38 2004
@@ -388,6 +388,10 @@
class FPInst<string n, bits<8> o, Format F, ArgType t, FPFormat fp>
: X86Inst<n, o, F, t> { let FPForm = fp; let FPFormBits = FPForm.Value; }
+// Pseudo instructions for floating point. We use these pseudo instructions
+// because they can be expanded by the fp spackifier into one of many different
+// forms of instructions for doing these operations. Until the stackifier runs,
+// we prefer to be abstract.
def FpMOV : FPInst<"FMOV", 0, Pseudo, ArgF80, SpecialFP>; // f1 = fmov f2
def FpADD : FPInst<"FADD", 0, Pseudo, ArgF80, TwoArgFP>; // f1 = fadd f2, f3
def FpSUB : FPInst<"FSUB", 0, Pseudo, ArgF80, TwoArgFP>; // f1 = fsub f2, f3
@@ -428,6 +432,10 @@
// Floating point constant loads...
def FLD0 : FPInst<"fldz", 0xEE, RawFrm, ArgF80, ZeroArgFP>, D9;
def FLD1 : FPInst<"fld1", 0xE8, RawFrm, ArgF80, ZeroArgFP>, D9;
+
+
+// Unary read-modify-write operations...
+def FCHS : FPInst<"fchs", 0xE0, RawFrm, ArgF80, OneArgFPRW>, D9, Imp<[ST0],[ST0]>; // f1 = fchs f2
// Binary arithmetic operations...
class FPST0rInst<string n, bits<8> o>
More information about the llvm-commits
mailing list