summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Tweed <david.tweed@arm.com>2013-01-10 09:11:33 +0000
committerDavid Tweed <david.tweed@arm.com>2013-01-10 09:11:33 +0000
commit9fb566c076c8acf122fa25fdf1e43ce5e79bffb1 (patch)
tree0c5b2431d87c2b04d1c9d865864f48bc8af3dfda /clang/lib/CodeGen
parent8e68b792b434f578809732eb29d7fcb506b68588 (diff)
downloadbcm5719-llvm-9fb566c076c8acf122fa25fdf1e43ce5e79bffb1.tar.gz
bcm5719-llvm-9fb566c076c8acf122fa25fdf1e43ce5e79bffb1.zip
Testing with a full OpenCL compiler (based on clang) reveals r71734 missed
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. llvm-svn: 172047
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index ae7518a2b94..fb5f58ddbb2 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2368,8 +2368,12 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) {
}
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) {
OpenPOWER on IntegriCloud