Skip to content

Commit 0905d9f

Browse files
committed
[SVE][CodeGen] Fix bug with store of unpacked FP scalable vectors
Fixed an incorrect pattern in lib/Target/AArch64/AArch64SVEInstrInfo.td for storing out <vscale x 2 x f32> unpacked scalable vectors. Added a couple of tests to test/CodeGen/AArch64/sve-st1-addressing-mode-reg-imm.ll Differential Revision: https://reviews.llvm.org/D85441
1 parent dbf44b8 commit 0905d9f

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ multiclass sve_prefetch<SDPatternOperator prefetch, ValueType PredTy, Instructio
17901790
defm : unpred_store< store, nxv4f16, ST1H_S_IMM, PTRUE_S>;
17911791
defm : unpred_store< store, nxv2f16, ST1H_D_IMM, PTRUE_D>;
17921792
defm : unpred_store< store, nxv4f32, ST1W_IMM, PTRUE_S>;
1793-
defm : unpred_store< store, nxv4f32, ST1W_D_IMM, PTRUE_D>;
1793+
defm : unpred_store< store, nxv2f32, ST1W_D_IMM, PTRUE_D>;
17941794
defm : unpred_store< store, nxv2f64, ST1D_IMM, PTRUE_D>;
17951795

17961796
multiclass unpred_load<PatFrag Load, ValueType Ty, Instruction RegImmInst,

llvm/test/CodeGen/AArch64/sve-st1-addressing-mode-reg-imm.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,32 @@ define void @st1d_inbound(<vscale x 2 x i64> %data, <vscale x 2 x i64>* %a) {
104104
store <vscale x 2 x i64> %data, <vscale x 2 x i64>* %base
105105
ret void
106106
}
107+
108+
109+
; Splat stores of unpacked FP scalable vectors
110+
111+
define void @store_nxv2f32(<vscale x 2 x float>* %out) {
112+
; CHECK-LABEL: store_nxv2f32:
113+
; CHECK: // %bb.0:
114+
; CHECK-NEXT: fmov z0.s, #1.00000000
115+
; CHECK-NEXT: ptrue p0.d
116+
; CHECK-NEXT: st1w { z0.d }, p0, [x0]
117+
; CHECK-NEXT: ret
118+
%ins = insertelement <vscale x 2 x float> undef, float 1.0, i32 0
119+
%splat = shufflevector <vscale x 2 x float> %ins, <vscale x 2 x float> undef, <vscale x 2 x i32> zeroinitializer
120+
store <vscale x 2 x float> %splat, <vscale x 2 x float>* %out
121+
ret void
122+
}
123+
124+
define void @store_nxv4f16(<vscale x 4 x half>* %out) {
125+
; CHECK-LABEL: store_nxv4f16:
126+
; CHECK: // %bb.0:
127+
; CHECK-NEXT: fmov z0.h, #1.00000000
128+
; CHECK-NEXT: ptrue p0.s
129+
; CHECK-NEXT: st1h { z0.s }, p0, [x0]
130+
; CHECK-NEXT: ret
131+
%ins = insertelement <vscale x 4 x half> undef, half 1.0, i32 0
132+
%splat = shufflevector <vscale x 4 x half> %ins, <vscale x 4 x half> undef, <vscale x 4 x i32> zeroinitializer
133+
store <vscale x 4 x half> %splat, <vscale x 4 x half>* %out
134+
ret void
135+
}

0 commit comments

Comments
 (0)