Skip to content

Commit 4ced088

Browse files
committed
[AArch64][SME] Fix bug on SMELd1St1
Patch[1] has update intrinsic interface for ld1/st1, while based on ARM's document, "If the intrinsic also has a vnum argument, the ZA slice number is calculated by adding vnum to slice.". But the "vnum" did not work for our realization now, this patch fix this point. [1]ee31ba0
1 parent 69d66fa commit 4ced088

File tree

3 files changed

+229
-114
lines changed

3 files changed

+229
-114
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10628,7 +10628,7 @@ Value *CodeGenFunction::EmitSMELd1St1(const SVETypeFlags &TypeFlags,
1062810628
NewOps.push_back(Ops[2]);
1062910629

1063010630
llvm::Value *BasePtr = Ops[3];
10631-
10631+
llvm::Value *RealSlice = Ops[1];
1063210632
// If the intrinsic contains the vnum parameter, multiply it with the vector
1063310633
// size in bytes.
1063410634
if (Ops.size() == 5) {
@@ -10640,10 +10640,13 @@ Value *CodeGenFunction::EmitSMELd1St1(const SVETypeFlags &TypeFlags,
1064010640
Builder.CreateMul(StreamingVectorLengthCall, Ops[4], "mulvl");
1064110641
// The type of the ptr parameter is void *, so use Int8Ty here.
1064210642
BasePtr = Builder.CreateGEP(Int8Ty, Ops[3], Mulvl);
10643+
RealSlice = Builder.CreateZExt(RealSlice, Int64Ty);
10644+
RealSlice = Builder.CreateAdd(RealSlice, Ops[4]);
10645+
RealSlice = Builder.CreateTrunc(RealSlice, Int32Ty);
1064310646
}
1064410647
NewOps.push_back(BasePtr);
1064510648
NewOps.push_back(Ops[0]);
10646-
NewOps.push_back(Ops[1]);
10649+
NewOps.push_back(RealSlice);
1064710650
Function *F = CGM.getIntrinsic(IntID);
1064810651
return Builder.CreateCall(F, NewOps);
1064910652
}

0 commit comments

Comments
 (0)