[llvm-commits] [llvm] r57915 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp
Dan Gohman
gohman at apple.com
Tue Oct 21 11:24:51 PDT 2008
Author: djg
Date: Tue Oct 21 13:24:51 2008
New Revision: 57915
URL: http://llvm.org/viewvc/llvm-project?rev=57915&view=rev
Log:
Implement the optimized FCMP_OEQ/FCMP_UNE code for x86 fast-isel.
Modified:
llvm/trunk/lib/Target/X86/X86FastISel.cpp
Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=57915&r1=57914&r2=57915&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Tue Oct 21 13:24:51 2008
@@ -692,6 +692,11 @@
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 @@
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;
More information about the llvm-commits
mailing list