diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index b3b8756ae9ba..c8d0f5faf647 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -60,7 +60,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/KnownBits.h" #include "llvm/Support/MachineValueType.h" -#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Mutex.h" #include "llvm/Support/raw_ostream.h" @@ -3271,6 +3270,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, Known.Zero.setBitsFrom(1); break; case ISD::SETCC: + case ISD::SETCCCARRY: case ISD::STRICT_FSETCC: case ISD::STRICT_FSETCCS: { unsigned OpNo = Op->isStrictFPOpcode() ? 1 : 0; @@ -3506,6 +3506,8 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, break; case ISD::USUBO: case ISD::SSUBO: + case ISD::SUBCARRY: + case ISD::SSUBO_CARRY: if (Op.getResNo() == 1) { // If we know the result of a setcc has the top bits zero, use this info. if (TLI->getBooleanContents(Op.getOperand(0).getValueType()) == @@ -3520,6 +3522,10 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, assert(Op.getResNo() == 0 && "We only compute knownbits for the difference here."); + // TODO: Compute influence of the carry operand. + if (Opcode == ISD::SUBCARRY || Opcode == ISD::SSUBO_CARRY) + break; + Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1); Known2 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1); Known = KnownBits::computeForAddSub(/* Add */ false, /* NSW */ false, @@ -3529,6 +3535,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, case ISD::UADDO: case ISD::SADDO: case ISD::ADDCARRY: + case ISD::SADDO_CARRY: if (Op.getResNo() == 1) { // If we know the result of a setcc has the top bits zero, use this info. if (TLI->getBooleanContents(Op.getOperand(0).getValueType()) == @@ -3548,7 +3555,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, if (Opcode == ISD::ADDE) // Can't track carry from glue, set carry to unknown. Carry.resetAll(); - else if (Opcode == ISD::ADDCARRY) + else if (Opcode == ISD::ADDCARRY || Opcode == ISD::SADDO_CARRY) // TODO: Compute known bits for the carry operand. Not sure if it is worth // the trouble (how often will we find a known carry bit). And I haven't // tested this very much yet, but something like this might work: @@ -3862,6 +3869,12 @@ bool SelectionDAG::isKnownToBeAPowerOfTwo(SDValue Val) const { if (C->getAPIntValue().zextOrTrunc(BitWidth).isPowerOf2()) return true; + // vscale(power-of-two) is a power-of-two for some targets + if (Val.getOpcode() == ISD::VSCALE && + getTargetLoweringInfo().isVScaleKnownToBeAPowerOfTwo() && + isKnownToBeAPowerOfTwo(Val.getOperand(0))) + return true; + // More could be done here, though the above checks are enough // to handle some common cases. @@ -4108,8 +4121,12 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts, return std::min(Tmp, Tmp2); case ISD::SADDO: case ISD::UADDO: + case ISD::SADDO_CARRY: + case ISD::ADDCARRY: case ISD::SSUBO: case ISD::USUBO: + case ISD::SSUBO_CARRY: + case ISD::SUBCARRY: case ISD::SMULO: case ISD::UMULO: if (Op.getResNo() != 1) @@ -4123,6 +4140,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts, return VTBits; break; case ISD::SETCC: + case ISD::SETCCCARRY: case ISD::STRICT_FSETCC: case ISD::STRICT_FSETCCS: { unsigned OpNo = Op->isStrictFPOpcode() ? 1 : 0; @@ -7505,6 +7523,8 @@ SDValue SelectionDAG::getAtomic(unsigned Opcode, const SDLoc &dl, EVT MemVT, Opcode == ISD::ATOMIC_LOAD_UMAX || Opcode == ISD::ATOMIC_LOAD_FADD || Opcode == ISD::ATOMIC_LOAD_FSUB || + Opcode == ISD::ATOMIC_LOAD_FMAX || + Opcode == ISD::ATOMIC_LOAD_FMIN || Opcode == ISD::ATOMIC_SWAP || Opcode == ISD::ATOMIC_STORE) && "Invalid Atomic Op"); @@ -10739,19 +10759,19 @@ namespace { } // end anonymous namespace -static ManagedStatic<std::set<EVT, EVT::compareRawBits>> EVTs; -static ManagedStatic<EVTArray> SimpleVTArray; -static ManagedStatic<sys::SmartMutex<true>> VTMutex; - /// getValueTypeList - Return a pointer to the specified value type. /// const EVT *SDNode::getValueTypeList(EVT VT) { + static std::set<EVT, EVT::compareRawBits> EVTs; + static EVTArray SimpleVTArray; + static sys::SmartMutex<true> VTMutex; + if (VT.isExtended()) { - sys::SmartScopedLock<true> Lock(*VTMutex); - return &(*EVTs->insert(VT).first); + sys::SmartScopedLock<true> Lock(VTMutex); + return &(*EVTs.insert(VT).first); } assert(VT.getSimpleVT() < MVT::VALUETYPE_SIZE && "Value type out of range!"); - return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy]; + return &SimpleVTArray.VTs[VT.getSimpleVT().SimpleTy]; } /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the |
