xref: /llvm-project/llvm/test/Transforms/LowerMatrixIntrinsics/strided-store-float.ll (revision 256d5ad3e8db42e125e4954fadeba2b37421d91f)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s
3
4define void @strided_store_3x2(<6 x float> %in, ptr %out) {
5; CHECK-LABEL: @strided_store_3x2(
6; CHECK-NEXT:    [[SPLIT:%.*]] = shufflevector <6 x float> [[IN:%.*]], <6 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
7; CHECK-NEXT:    [[SPLIT1:%.*]] = shufflevector <6 x float> [[IN]], <6 x float> poison, <3 x i32> <i32 3, i32 4, i32 5>
8; CHECK-NEXT:    store <3 x float> [[SPLIT]], ptr [[OUT:%.*]], align 4
9; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[OUT]], i64 5
10; CHECK-NEXT:    store <3 x float> [[SPLIT1]], ptr [[VEC_GEP]], align 4
11; CHECK-NEXT:    ret void
12;
13  call void @llvm.matrix.column.major.store(<6 x float> %in, ptr %out, i64 5, i1 false, i32 3, i32 2)
14  ret void
15}
16
17define void @strided_store_3x2_nonconst_stride(<6 x float> %in, i64 %stride, ptr %out) {
18; CHECK-LABEL: @strided_store_3x2_nonconst_stride(
19; CHECK-NEXT:    [[SPLIT:%.*]] = shufflevector <6 x float> [[IN:%.*]], <6 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
20; CHECK-NEXT:    [[SPLIT1:%.*]] = shufflevector <6 x float> [[IN]], <6 x float> poison, <3 x i32> <i32 3, i32 4, i32 5>
21; CHECK-NEXT:    [[VEC_START:%.*]] = mul i64 0, [[STRIDE:%.*]]
22; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[OUT:%.*]], i64 [[VEC_START]]
23; CHECK-NEXT:    store <3 x float> [[SPLIT]], ptr [[VEC_GEP]], align 4
24; CHECK-NEXT:    [[VEC_START2:%.*]] = mul i64 1, [[STRIDE]]
25; CHECK-NEXT:    [[VEC_GEP3:%.*]] = getelementptr float, ptr [[OUT]], i64 [[VEC_START2]]
26; CHECK-NEXT:    store <3 x float> [[SPLIT1]], ptr [[VEC_GEP3]], align 4
27; CHECK-NEXT:    ret void
28;
29  call void @llvm.matrix.column.major.store(<6 x float> %in, ptr %out, i64 %stride, i1 false, i32 3, i32 2)
30  ret void
31}
32
33
34declare void @llvm.matrix.column.major.store(<6 x float>, ptr, i64, i1, i32, i32)
35
36define void @strided_store_2x3(<10 x float> %in, ptr %out) {
37; CHECK-LABEL: @strided_store_2x3(
38; CHECK-NEXT:    [[SPLIT:%.*]] = shufflevector <10 x float> [[IN:%.*]], <10 x float> poison, <2 x i32> <i32 0, i32 1>
39; CHECK-NEXT:    [[SPLIT1:%.*]] = shufflevector <10 x float> [[IN]], <10 x float> poison, <2 x i32> <i32 2, i32 3>
40; CHECK-NEXT:    [[SPLIT2:%.*]] = shufflevector <10 x float> [[IN]], <10 x float> poison, <2 x i32> <i32 4, i32 5>
41; CHECK-NEXT:    [[SPLIT3:%.*]] = shufflevector <10 x float> [[IN]], <10 x float> poison, <2 x i32> <i32 6, i32 7>
42; CHECK-NEXT:    [[SPLIT4:%.*]] = shufflevector <10 x float> [[IN]], <10 x float> poison, <2 x i32> <i32 8, i32 9>
43; CHECK-NEXT:    store <2 x float> [[SPLIT]], ptr [[OUT:%.*]], align 4
44; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[OUT]], i64 4
45; CHECK-NEXT:    store <2 x float> [[SPLIT1]], ptr [[VEC_GEP]], align 4
46; CHECK-NEXT:    [[VEC_GEP6:%.*]] = getelementptr float, ptr [[OUT]], i64 8
47; CHECK-NEXT:    store <2 x float> [[SPLIT2]], ptr [[VEC_GEP6]], align 4
48; CHECK-NEXT:    [[VEC_GEP8:%.*]] = getelementptr float, ptr [[OUT]], i64 12
49; CHECK-NEXT:    store <2 x float> [[SPLIT3]], ptr [[VEC_GEP8]], align 4
50; CHECK-NEXT:    [[VEC_GEP10:%.*]] = getelementptr float, ptr [[OUT]], i64 16
51; CHECK-NEXT:    store <2 x float> [[SPLIT4]], ptr [[VEC_GEP10]], align 4
52; CHECK-NEXT:    ret void
53;
54  call void @llvm.matrix.column.major.store.v10f32(<10 x float> %in, ptr %out, i64 4, i1 false, i32 2, i32 5)
55  ret void
56}
57
58declare void @llvm.matrix.column.major.store.v10f32(<10 x float>, ptr, i64, i1, i32, i32)
59