================ @@ -9665,18 +9665,34 @@ Value *CodeGenFunction::EmitSMEZero(const SVETypeFlags &TypeFlags, Value *CodeGenFunction::EmitSMELdrStr(const SVETypeFlags &TypeFlags, SmallVectorImpl<Value *> &Ops, unsigned IntID) { - 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"); - - Ops[1] = Builder.CreateGEP(Int8Ty, Ops[1], MulVL); - Ops[0] = EmitTileslice(Ops[0], Ops[2]); - Ops.erase(&Ops[2]); - } + if (Ops.size() == 2) { + // Intrinsics without a vecnum also use this function, so just provide 0 + Ops.push_back(Ops[1]); + Ops[1] = Builder.getInt32(0); + } else { + int Imm = -1; + if (ConstantInt* C = dyn_cast<ConstantInt>(Ops[2])) + if (C->getZExtValue() <= 15) + Imm = C->getZExtValue(); + + if (Imm != -1) { + Ops[2] = Ops[1]; + Ops[1] = Builder.getInt32(Imm); ---------------- SamTebbs33 wrote:
The thing is that I want the rest of the code to run if the argument is an immediate but it isn't in the range of 0 - 15. I could move the <= 15 check to where `Imm != -1` is, I think that would be cleaner. https://github.com/llvm/llvm-project/pull/68565 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits