diff options
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 401802e..7306d86 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -170,7 +170,7 @@ void PHINode::resizeOperands(unsigned NumOps) { /// value dominates the PHI. If DT is null, use a conservative check, /// otherwise use DT to test for dominance. /// -Value *PHINode::hasConstantValue(DominatorTree *DT) const { +Value *PHINode::hasConstantValue(const DominatorTree *DT) const { // If the PHI node only has one incoming value, eliminate the PHI node. if (getNumIncomingValues() == 1) { if (getIncomingValue(0) != this) // not X = phi X @@ -899,7 +899,7 @@ void AllocaInst::setAlignment(unsigned Align) { bool AllocaInst::isArrayAllocation() const { if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0))) - return CI->getZExtValue() != 1; + return !CI->isOne(); return true; } @@ -2360,6 +2360,8 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) { } else { // Casting from something else return false; } + } else if (DestTy->isX86_MMXTy()) { + return SrcBits == 64; } else { // Casting to something else return false; } @@ -2441,6 +2443,10 @@ CastInst::getCastOpcode( return BitCast; // vector -> vector } else if (DestPTy->getBitWidth() == SrcBits) { return BitCast; // float/int -> vector + } else if (SrcTy->isX86_MMXTy()) { + assert(DestPTy->getBitWidth()==64 && + "Casting X86_MMX to vector of wrong width"); + return BitCast; // MMX to 64-bit vector } else { assert(!"Illegal cast to vector (wrong type or size)"); } @@ -2452,6 +2458,14 @@ CastInst::getCastOpcode( } else { assert(!"Casting pointer to other than pointer or int"); } + } else if (DestTy->isX86_MMXTy()) { + if (isa<VectorType>(SrcTy)) { + assert(cast<VectorType>(SrcTy)->getBitWidth() == 64 && + "Casting vector of wrong width to X86_MMX"); + return BitCast; // 64-bit vector to MMX + } else { + assert(!"Illegal cast to X86_MMX"); + } } else { assert(!"Casting to type that is not first-class"); } |