Force vectors to be a power of two in size
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24265 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index d605218..84e064e 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -1107,12 +1107,12 @@
}
| '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type?
const llvm::Type* ElemTy = $4->get();
- if ((unsigned)$2 != $2) {
+ if ((unsigned)$2 != $2)
ThrowException("Unsigned result not equal to signed result");
- }
- if(!ElemTy->isPrimitiveType()) {
+ if (!ElemTy->isPrimitiveType())
ThrowException("Elemental type of a PackedType must be primitive");
- }
+ if (!isPowerOf2_32($2))
+ ThrowException("Vector length should be a power of 2!");
$$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2)));
delete $4;
}