From aef162c33fa020c0a742e263829377e262e74ca7 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 3 May 2016 19:22:41 +0000 Subject: [PATCH] AArch64: simplify illegal vector check. NFC. Use a utility function to check whether the number of elements is a power of 2 and drop the redundant upper limit (a 128-bit vector with more than 16 elements would have each element < 8 bits, not possible). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268422 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index db7c1f0e7e..0777ba46c9 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -4614,7 +4614,7 @@ bool AArch64ABIInfo::isIllegalVectorType(QualType Ty) const { unsigned NumElements = VT->getNumElements(); uint64_t Size = getContext().getTypeSize(VT); // NumElements should be power of 2 between 1 and 16. - if ((NumElements & (NumElements - 1)) != 0 || NumElements > 16) + if (!llvm::isPowerOf2_32(NumElements)) return true; return Size != 64 && (Size != 128 || NumElements == 1); } -- 2.40.0