Skip to content

Commit 3c83054

Browse files
committed
[RISCV] Add tests for suboptimal interleave patterns
Upcoming changes will improve codegen in these cases per the included TOOOs.
1 parent 84efad0 commit 3c83054

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-interleaved-access.ll

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,3 +1247,55 @@ define <4 x i8> @load_factor8_one_active(ptr %ptr) vscale_range(8,1024) {
12471247
%v0 = shufflevector <32 x i8> %interleaved.vec, <32 x i8> poison, <4 x i32> <i32 0, i32 8, i32 16, i32 24>
12481248
ret <4 x i8> %v0
12491249
}
1250+
1251+
define void @load_factor4_one_active_storeback(ptr %ptr) {
1252+
; CHECK-LABEL: load_factor4_one_active_storeback:
1253+
; CHECK: # %bb.0:
1254+
; CHECK-NEXT: li a1, 16
1255+
; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1256+
; CHECK-NEXT: vlse32.v v8, (a0), a1
1257+
; CHECK-NEXT: vse32.v v8, (a0)
1258+
; CHECK-NEXT: ret
1259+
%interleaved.vec = load <16 x i32>, ptr %ptr
1260+
%v0 = shufflevector <16 x i32> %interleaved.vec, <16 x i32> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
1261+
store <4 x i32> %v0, ptr %ptr
1262+
ret void
1263+
}
1264+
1265+
; TODO: This should be a strided load
1266+
define void @load_factor4_one_active_storeback_full(ptr %ptr) {
1267+
; CHECK-LABEL: load_factor4_one_active_storeback_full:
1268+
; CHECK: # %bb.0:
1269+
; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1270+
; CHECK-NEXT: vle32.v v8, (a0)
1271+
; CHECK-NEXT: vsetivli zero, 4, e32, m2, ta, ma
1272+
; CHECK-NEXT: vslidedown.vi v12, v8, 4
1273+
; CHECK-NEXT: vmv1r.v v13, v8
1274+
; CHECK-NEXT: vmv1r.v v14, v12
1275+
; CHECK-NEXT: vsetivli zero, 4, e32, m4, ta, ma
1276+
; CHECK-NEXT: vslidedown.vi v16, v8, 8
1277+
; CHECK-NEXT: vmv1r.v v15, v16
1278+
; CHECK-NEXT: vslidedown.vi v16, v8, 12
1279+
; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1280+
; CHECK-NEXT: vsseg4e32.v v13, (a0)
1281+
; CHECK-NEXT: ret
1282+
%interleaved.vec = load <16 x i32>, ptr %ptr
1283+
%v0 = shufflevector <16 x i32> %interleaved.vec, <16 x i32> poison, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
1284+
store <16 x i32> %v0, ptr %ptr
1285+
ret void
1286+
}
1287+
1288+
; TODO: This should be a strided store
1289+
define void @store_factor4_one_active_storeback(ptr %ptr, <4 x i32> %v) {
1290+
; CHECK-LABEL: store_factor4_one_active_storeback:
1291+
; CHECK: # %bb.0:
1292+
; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1293+
; CHECK-NEXT: vslideup.vi v9, v8, 1
1294+
; CHECK-NEXT: vmv.v.v v10, v9
1295+
; CHECK-NEXT: vmv.v.v v11, v9
1296+
; CHECK-NEXT: vsseg4e32.v v8, (a0)
1297+
; CHECK-NEXT: ret
1298+
%v0 = shufflevector <4 x i32> %v, <4 x i32> poison, <16 x i32> <i32 0, i32 undef, i32 undef, i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i32 2, i32 undef, i32 undef, i32 undef, i32 3, i32 undef, i32 undef, i32 undef>
1299+
store <16 x i32> %v0, ptr %ptr
1300+
ret void
1301+
}

0 commit comments

Comments
 (0)