[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Jan 10 19:50:59 PST 2005
Changes in directory llvm/lib/Target/X86:
X86ISelPattern.cpp updated: 1.24 -> 1.25
---
Log message:
Be more careful where we set ContainsFPCode. We were missing a set in the
int -> FP casting code. Note that we don't have to set it for FP operations
that take FP values as operands: whatever produces the FP value will set the
flag.
---
Diffs of the changes: (+10 -15)
Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.24 llvm/lib/Target/X86/X86ISelPattern.cpp:1.25
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.24 Mon Jan 10 21:37:59 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp Mon Jan 10 21:50:45 2005
@@ -609,7 +609,6 @@
return false;
}
- ContainsFPCode = true;
unsigned Opc2 = 0; // Second branch if needed.
// On a floating point condition, the flags are set as follows:
@@ -753,7 +752,7 @@
case MVT::i16: Opc = CMOVTAB16[CondCode]; break;
case MVT::i32: Opc = CMOVTAB32[CondCode]; break;
case MVT::f32:
- case MVT::f64: Opc = CMOVTABFP[CondCode]; ContainsFPCode = true; break;
+ case MVT::f64: Opc = CMOVTABFP[CondCode]; break;
}
}
@@ -769,7 +768,7 @@
case MVT::i16: Opc = X86::CMOVE16rr; break;
case MVT::i32: Opc = X86::CMOVE32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FCMOVE; ContainsFPCode = true; break;
+ case MVT::f64: Opc = X86::FCMOVE; break;
}
} else {
// FIXME: CMP R, 0 -> TEST R, R
@@ -804,7 +803,7 @@
case MVT::i16: Opc = X86::CMP16rr; break;
case MVT::i32: Opc = X86::CMP32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FUCOMIr; ContainsFPCode = true; break;
+ case MVT::f64: Opc = X86::FUCOMIr; break;
}
unsigned Tmp1, Tmp2;
if (getRegPressure(LHS) > getRegPressure(RHS)) {
@@ -909,7 +908,6 @@
case ISD::FP_EXTEND:
Tmp1 = SelectExpr(N.getOperand(0));
BuildMI(BB, X86::FpMOV, 1, Result).addReg(Tmp1);
- ContainsFPCode = true;
return Result;
case ISD::ZERO_EXTEND: {
int DestIs16 = N.getValueType() == MVT::i16;
@@ -980,12 +978,12 @@
// Emit the store, then the reload.
addFrameReference(BuildMI(BB, X86::FST32m, 5), Tmp2).addReg(Tmp1);
addFrameReference(BuildMI(BB, X86::FLD32m, 5, Result), Tmp2);
- ContainsFPCode = true;
return Result;
case ISD::SINT_TO_FP:
case ISD::UINT_TO_FP: {
// FIXME: Most of this grunt work should be done by legalize!
+ ContainsFPCode = true;
// Promote the integer to a type supported by FLD. We do this because there
// are no unsigned FLD instructions, so we must promote an unsigned value to
@@ -1246,7 +1244,7 @@
case MVT::i16: Opc = X86::ADD16rr; break;
case MVT::i32: Opc = X86::ADD32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FpADD; ContainsFPCode = true; break;
+ case MVT::f64: Opc = X86::FpADD; break;
}
if (getRegPressure(N.getOperand(0)) > getRegPressure(N.getOperand(1))) {
@@ -1303,7 +1301,7 @@
case MVT::i16: Opc = X86::SUB16rr; break;
case MVT::i32: Opc = X86::SUB32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FpSUB; ContainsFPCode = true; break;
+ case MVT::f64: Opc = X86::FpSUB; break;
}
BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2);
return Result;
@@ -1436,7 +1434,7 @@
case MVT::i16: Opc = X86::IMUL16rr; break;
case MVT::i32: Opc = X86::IMUL32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FpMUL; ContainsFPCode = true; break;
+ case MVT::f64: Opc = X86::FpMUL; break;
}
BuildMI(BB, Opc, 2, Result).addReg(Tmp1).addReg(Tmp2);
return Result;
@@ -1567,7 +1565,6 @@
case MVT::i64: assert(0 && "FIXME: implement i64 DIV/REM libcalls!");
case MVT::f32:
case MVT::f64:
- ContainsFPCode = true;
if (N.getOpcode() == ISD::SDIV)
BuildMI(BB, X86::FpDIV, 2, Result).addReg(Tmp1).addReg(Tmp2);
else
@@ -1686,8 +1683,6 @@
return Result;
case ISD::SETCC:
- if (MVT::isFloatingPoint(N.getOperand(0).getValueType()))
- ContainsFPCode = true;
EmitCMP(N.getOperand(0), N.getOperand(1));
EmitSetCC(BB, Result, cast<SetCCSDNode>(N)->getCondition(),
MVT::isFloatingPoint(N.getOperand(1).getValueType()));
@@ -1844,7 +1839,7 @@
case MVT::i16: Opc = X86::MOV16rr; break;
case MVT::i32: Opc = X86::MOV32rr; break;
case MVT::f32:
- case MVT::f64: Opc = X86::FpMOV; break;
+ case MVT::f64: Opc = X86::FpMOV; ContainsFPCode = true; break;
}
BuildMI(BB, Opc, 1, Tmp2).addReg(Tmp1);
}
@@ -1966,8 +1961,8 @@
case MVT::i8: Opc = X86::MOV8mr; break;
case MVT::i16: Opc = X86::MOV16mr; break;
case MVT::i32: Opc = X86::MOV32mr; break;
- case MVT::f32: Opc = X86::FST32m; ContainsFPCode = true; break;
- case MVT::f64: Opc = X86::FST64m; ContainsFPCode = true; break;
+ case MVT::f32: Opc = X86::FST32m; break;
+ case MVT::f64: Opc = X86::FST64m; break;
}
std::vector<std::pair<unsigned, unsigned> > RP;
More information about the llvm-commits
mailing list