summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-05-23 06:40:47 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-05-23 06:40:47 +0000
commitf6f9581983c85f8b4d2775b22870c1a4516fabdf (patch)
treed4f9ef8ff714a0c3770bd7298fecab071048c863 /lib/CodeGen
parent95942d76f4fdd1191febf1aa2b612fce6351ab3b (diff)
downloadllvm-f6f9581983c85f8b4d2775b22870c1a4516fabdf.tar.gz
llvm-f6f9581983c85f8b4d2775b22870c1a4516fabdf.tar.bz2
llvm-f6f9581983c85f8b4d2775b22870c1a4516fabdf.tar.xz
Incorrect SETCC CondCode used for FP comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index e88b371baf..4439688d43 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -512,13 +512,20 @@ public:
visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA);
}
- void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc);
- void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ); }
- void visitSetNE(User &I) { visitSetCC(I, ISD::SETNE, ISD::SETNE); }
- void visitSetLE(User &I) { visitSetCC(I, ISD::SETLE, ISD::SETULE); }
- void visitSetGE(User &I) { visitSetCC(I, ISD::SETGE, ISD::SETUGE); }
- void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT); }
- void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT); }
+ void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc,
+ ISD::CondCode FPOpc);
+ void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ,
+ ISD::SETOEQ); }
+ void visitSetNE(User &I) { visitSetCC(I, ISD::SETNE, ISD::SETNE,
+ ISD::SETUNE); }
+ void visitSetLE(User &I) { visitSetCC(I, ISD::SETLE, ISD::SETULE,
+ ISD::SETOLE); }
+ void visitSetGE(User &I) { visitSetCC(I, ISD::SETGE, ISD::SETUGE,
+ ISD::SETOGE); }
+ void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT,
+ ISD::SETOLT); }
+ void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT,
+ ISD::SETOGT); }
void visitExtractElement(User &I);
void visitInsertElement(User &I);
@@ -1092,11 +1099,15 @@ void SelectionDAGLowering::visitShift(User &I, unsigned Opcode) {
}
void SelectionDAGLowering::visitSetCC(User &I,ISD::CondCode SignedOpcode,
- ISD::CondCode UnsignedOpcode) {
+ ISD::CondCode UnsignedOpcode,
+ ISD::CondCode FPOpcode) {
SDOperand Op1 = getValue(I.getOperand(0));
SDOperand Op2 = getValue(I.getOperand(1));
ISD::CondCode Opcode = SignedOpcode;
- if (I.getOperand(0)->getType()->isUnsigned())
+ if ((!UnsafeFPMath && !FiniteOnlyFPMath) &&
+ I.getOperand(0)->getType()->isFloatingPoint())
+ Opcode = FPOpcode;
+ else if (I.getOperand(0)->getType()->isUnsigned())
Opcode = UnsignedOpcode;
setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Opcode));
}