summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FastISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-21 18:24:51 +0000
committerDan Gohman <gohman@apple.com>2008-10-21 18:24:51 +0000
commit4ddf7a4c2227709629a1c37c8f504c9c793f781c (patch)
tree91b9b68d72b4523f9f25053f27346d4ddf97bc96 /llvm/lib/Target/X86/X86FastISel.cpp
parent5cfa5af6300cd8ec09aa3c831741989feb31ed93 (diff)
downloadbcm5719-llvm-4ddf7a4c2227709629a1c37c8f504c9c793f781c.tar.gz
bcm5719-llvm-4ddf7a4c2227709629a1c37c8f504c9c793f781c.zip
Implement the optimized FCMP_OEQ/FCMP_UNE code for x86 fast-isel.
llvm-svn: 57915
Diffstat (limited to 'llvm/lib/Target/X86/X86FastISel.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FastISel.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp
index 6284bba0927..b280d652901 100644
--- a/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/llvm/lib/Target/X86/X86FastISel.cpp
@@ -692,6 +692,11 @@ bool X86FastISel::X86SelectBranch(Instruction *I) {
unsigned BranchOpc; // Opcode to jump on, e.g. "X86::JA"
switch (Predicate) {
+ case CmpInst::FCMP_OEQ:
+ std::swap(TrueMBB, FalseMBB);
+ Predicate = CmpInst::FCMP_UNE;
+ // FALL THROUGH
+ case CmpInst::FCMP_UNE: SwapArgs = false; BranchOpc = X86::JNE; break;
case CmpInst::FCMP_OGT: SwapArgs = false; BranchOpc = X86::JA; break;
case CmpInst::FCMP_OGE: SwapArgs = false; BranchOpc = X86::JAE; break;
case CmpInst::FCMP_OLT: SwapArgs = true; BranchOpc = X86::JA; break;
@@ -728,6 +733,13 @@ bool X86FastISel::X86SelectBranch(Instruction *I) {
return false;
BuildMI(MBB, TII.get(BranchOpc)).addMBB(TrueMBB);
+
+ if (Predicate == CmpInst::FCMP_UNE) {
+ // X86 requires a second branch to handle UNE (and OEQ,
+ // which is mapped to UNE above).
+ BuildMI(MBB, TII.get(X86::JP)).addMBB(TrueMBB);
+ }
+
FastEmitBranch(FalseMBB);
MBB->addSuccessor(TrueMBB);
return true;
OpenPOWER on IntegriCloud