[llvm] [AArch64] Refactor creation of a shuffle mask for TBL (NFC) (PR #92529)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 03:06:31 PDT 2024


================
@@ -15710,48 +15710,51 @@ bool AArch64TargetLowering::shouldSinkOperands(
   return false;
 }
 
-static bool createTblShuffleForZExt(ZExtInst *ZExt, FixedVectorType *DstTy,
-                                    bool IsLittleEndian) {
-  Value *Op = ZExt->getOperand(0);
-  auto *SrcTy = cast<FixedVectorType>(Op->getType());
-  auto SrcWidth = cast<IntegerType>(SrcTy->getElementType())->getBitWidth();
-  auto DstWidth = cast<IntegerType>(DstTy->getElementType())->getBitWidth();
+static bool createTblShuffleMask(unsigned SrcWidth, unsigned DstWidth,
+                                 unsigned NumElts, bool IsLittleEndian,
+                                 SmallVectorImpl<int> &Mask) {
   if (DstWidth % 8 != 0 || DstWidth <= 16 || DstWidth >= 64)
     return false;
 
-  assert(DstWidth % SrcWidth == 0 &&
----------------
fhahn wrote:

Is the assert replaced by an `if` because it may trigger, possibly on an untested path?

https://github.com/llvm/llvm-project/pull/92529


More information about the llvm-commits mailing list