difference between type widths of a vector and the width of one of its elements
in the case of vector shifts. Use correct witdth in the vector case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172047
91177308-0d34-0410-b5e6-
96231b3b80d8
}
Value *ScalarExprEmitter::GetWidthMinusOneValue(Value* LHS,Value* RHS) {
- unsigned Width = cast<llvm::IntegerType>(LHS->getType())->getBitWidth();
- return llvm::ConstantInt::get(RHS->getType(), Width - 1);
+ llvm::IntegerType *Ty;
+ if (llvm::VectorType *VT = dyn_cast<llvm::VectorType>(LHS->getType()))
+ Ty = cast<llvm::IntegerType>(VT->getElementType());
+ else
+ Ty = cast<llvm::IntegerType>(LHS->getType());
+ return llvm::ConstantInt::get(RHS->getType(), Ty->getBitWidth() - 1);
}
Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {