[clang] [AArch64][SME] Remove immediate argument restriction for svldr and svstr (PR #68908)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 13 06:22:34 PDT 2023
================
@@ -9716,13 +9716,16 @@ Value *CodeGenFunction::EmitSMELdrStr(const SVETypeFlags &TypeFlags,
if (Ops.size() == 3) {
Function *Cntsb = CGM.getIntrinsic(Intrinsic::aarch64_sme_cntsb);
llvm::Value *CntsbCall = Builder.CreateCall(Cntsb, {}, "svlb");
- llvm::Value *MulVL = Builder.CreateMul(
- CntsbCall,
- Builder.getInt64(cast<llvm::ConstantInt>(Ops[2])->getZExtValue()),
- "mulvl");
+
+ llvm::Value *VecNum = Ops[2];
+ if (auto *C = dyn_cast<ConstantInt>(VecNum))
+ VecNum = Builder.getInt64(C->getZExtValue());
+
+ llvm::Value *MulVL = Builder.CreateMul(CntsbCall, VecNum, "mulvl");
Ops[1] = Builder.CreateGEP(Int8Ty, Ops[1], MulVL);
- Ops[0] = EmitTileslice(Ops[0], Ops[2]);
+ Ops[0] =
+ EmitTileslice(Ops[0], Builder.CreateIntCast(VecNum, Int32Ty, true));
----------------
sdesmalen-arm wrote:
Because EmitTileSlice is defined with the operands `Value *Offset, Value *Base`, this is passing the operands in the wrong order. EmitTileSlice will then create cast to Int32Ty for you. That said, given that `EmitTileSlice` has only one use and is two lines of code, you can just as well inline the function and remove it.
https://github.com/llvm/llvm-project/pull/68908
More information about the cfe-commits
mailing list