[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 15 16:55:01 PDT 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.262 -> 1.263

---
Log message:

Remove support for llvm.isnan.  Alkis wins :)


---
Diffs of the changes:  (+0 -50)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.262 llvm/lib/Target/X86/InstSelectSimple.cpp:1.263
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.262	Tue Jun 15 16:36:44 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Tue Jun 15 16:48:07 2004
@@ -1619,32 +1619,6 @@
   doCall(ValueRecord(DestReg, CI.getType()), TheCall, Args);
 }         
 
-/// dyncastIsNan - Return the operand of an isnan operation if this is an isnan.
-///
-static Value *dyncastIsNan(Value *V) {
-  if (CallInst *CI = dyn_cast<CallInst>(V))
-    if (Function *F = CI->getCalledFunction())
-      if (F->getIntrinsicID() == Intrinsic::isnan)
-        return CI->getOperand(1);
-  return 0;
-}
-
-/// isOnlyUsedByUnorderedComparisons - Return true if this value is only used by
-/// or's whos operands are all calls to the isnan predicate.
-static bool isOnlyUsedByUnorderedComparisons(Value *V) {
-  assert(dyncastIsNan(V) && "The value isn't an isnan call!");
-
-  // Check all uses, which will be or's of isnans if this predicate is true.
-  for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){
-    Instruction *I = cast<Instruction>(*UI);
-    if (I->getOpcode() != Instruction::Or) return false;
-    if (I->getOperand(0) != V && !dyncastIsNan(I->getOperand(0))) return false;
-    if (I->getOperand(1) != V && !dyncastIsNan(I->getOperand(1))) return false;
-  }
-
-  return true;
-}
-
 /// LowerUnknownIntrinsicFunctionCalls - This performs a prepass over the
 /// function, lowering any calls to unknown intrinsic functions into the
 /// equivalent LLVM code.
@@ -1663,7 +1637,6 @@
           case Intrinsic::frameaddress:
           case Intrinsic::memcpy:
           case Intrinsic::memset:
-          case Intrinsic::isnan:
           case Intrinsic::isunordered:
           case Intrinsic::readport:
           case Intrinsic::writeport:
@@ -1734,15 +1707,6 @@
     }
     return;
 
-  case Intrinsic::isnan:
-    // If this is only used by 'isunordered' style comparisons, don't emit it.
-    if (isOnlyUsedByUnorderedComparisons(&CI)) return;
-    TmpReg1 = getReg(CI.getOperand(1));
-    emitUCOMr(BB, BB->end(), TmpReg1, TmpReg1);
-    TmpReg2 = getReg(CI);
-    BuildMI(BB, X86::SETPr, 0, TmpReg2);
-    return;
-
   case Intrinsic::isunordered:
     TmpReg1 = getReg(CI.getOperand(1));
     TmpReg2 = getReg(CI.getOperand(2));
@@ -2162,20 +2126,6 @@
     return;
   }
 
-  if (Op0->getType() == Type::BoolTy) {
-    if (OperatorClass == 3)
-      // If this is an or of two isnan's, emit an FP comparison directly instead
-      // of or'ing two isnan's together.
-      if (Value *LHS = dyncastIsNan(Op0))
-        if (Value *RHS = dyncastIsNan(Op1)) {
-          unsigned Op0Reg = getReg(RHS, MBB, IP), Op1Reg = getReg(LHS, MBB, IP);
-          emitUCOMr(MBB, IP, Op0Reg, Op1Reg);
-          BuildMI(*MBB, IP, X86::SETPr, 0, DestReg);
-          return;
-        }
-          
-  }
-
   // sub 0, X -> neg X
   if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0))
     if (OperatorClass == 1 && CI->isNullValue()) {





More information about the llvm-commits mailing list