diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-14 18:15:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-14 18:15:46 +0000 |
commit | 34442e6ebf50d387d989a0377811891024dcd0a7 (patch) | |
tree | eb6da1371686101d2663514387ad020765e44ae3 /llvm/lib/CodeGen | |
parent | 556c45e9c5ff293a9cf4136f4fe8b8592bab992a (diff) | |
download | bcm5719-llvm-34442e6ebf50d387d989a0377811891024dcd0a7.tar.gz bcm5719-llvm-34442e6ebf50d387d989a0377811891024dcd0a7.zip |
revert my ConstantVector patch, it seems to have made the llvm-gcc
builders unhappy.
llvm-svn: 125504
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index fc283a36223..09e33e2e628 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2387,14 +2387,30 @@ void SelectionDAGBuilder::visitIndirectBr(const IndirectBrInst &I) { void SelectionDAGBuilder::visitFSub(const User &I) { // -0.0 - X --> fneg const Type *Ty = I.getType(); - if (isa<Constant>(I.getOperand(0)) && - I.getOperand(0) == ConstantFP::getZeroValueForNegation(Ty)) { - SDValue Op2 = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), - Op2.getValueType(), Op2)); - return; + if (Ty->isVectorTy()) { + if (ConstantVector *CV = dyn_cast<ConstantVector>(I.getOperand(0))) { + const VectorType *DestTy = cast<VectorType>(I.getType()); + const Type *ElTy = DestTy->getElementType(); + unsigned VL = DestTy->getNumElements(); + std::vector<Constant*> NZ(VL, ConstantFP::getNegativeZero(ElTy)); + Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); + if (CV == CNZ) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; + } + } } + if (ConstantFP *CFP = dyn_cast<ConstantFP>(I.getOperand(0))) + if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { + SDValue Op2 = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FNEG, getCurDebugLoc(), + Op2.getValueType(), Op2)); + return; + } + visitBinary(I, ISD::FSUB); } |