r268422 - AArch64: simplify illegal vector check. NFC.

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 12:22:41 PDT 2016


Author: tnorthover
Date: Tue May  3 14:22:41 2016
New Revision: 268422

URL: http://llvm.org/viewvc/llvm-project?rev=268422&view=rev
Log:
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).

Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=268422&r1=268421&r2=268422&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue May  3 14:22:41 2016
@@ -4614,7 +4614,7 @@ bool AArch64ABIInfo::isIllegalVectorType
     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);
   }




More information about the cfe-commits mailing list