xref: /llvm-project/llvm/test/Transforms/LowerMatrixIntrinsics/strided-load-float.ll (revision 8b56da5e9f3ba737a5ff4bf5dee654416849042f)
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 <9 x float> @strided_load_3x3(ptr %in, i64 %stride) {
5; CHECK-LABEL: @strided_load_3x3(
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    [[VEC_START:%.*]] = mul i64 0, [[STRIDE:%.*]]
8; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[IN:%.*]], i64 [[VEC_START]]
9; CHECK-NEXT:    [[COL_LOAD:%.*]] = load <3 x float>, ptr [[VEC_GEP]], align 4
10; CHECK-NEXT:    [[VEC_START1:%.*]] = mul i64 1, [[STRIDE]]
11; CHECK-NEXT:    [[VEC_GEP2:%.*]] = getelementptr float, ptr [[IN]], i64 [[VEC_START1]]
12; CHECK-NEXT:    [[COL_LOAD4:%.*]] = load <3 x float>, ptr [[VEC_GEP2]], align 4
13; CHECK-NEXT:    [[VEC_START5:%.*]] = mul i64 2, [[STRIDE]]
14; CHECK-NEXT:    [[VEC_GEP6:%.*]] = getelementptr float, ptr [[IN]], i64 [[VEC_START5]]
15; CHECK-NEXT:    [[COL_LOAD8:%.*]] = load <3 x float>, ptr [[VEC_GEP6]], align 4
16; CHECK-NEXT:    [[TMP0:%.*]] = shufflevector <3 x float> [[COL_LOAD]], <3 x float> [[COL_LOAD4]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5>
17; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <3 x float> [[COL_LOAD8]], <3 x float> poison, <6 x i32> <i32 0, i32 1, i32 2, i32 poison, i32 poison, i32 poison>
18; CHECK-NEXT:    [[TMP2:%.*]] = shufflevector <6 x float> [[TMP0]], <6 x float> [[TMP1]], <9 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>
19; CHECK-NEXT:    ret <9 x float> [[TMP2]]
20;
21entry:
22  %load = call <9 x float> @llvm.matrix.column.major.load(ptr %in, i64 %stride, i1 false, i32 3, i32 3)
23  ret <9 x float> %load
24}
25
26declare <9 x float> @llvm.matrix.column.major.load(ptr, i64, i1, i32, i32)
27
28define <9 x float> @strided_load_9x1(ptr %in, i64 %stride) {
29; CHECK-LABEL: @strided_load_9x1(
30; CHECK-NEXT:  entry:
31; CHECK-NEXT:    [[VEC_START:%.*]] = mul i64 0, [[STRIDE:%.*]]
32; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[IN:%.*]], i64 [[VEC_START]]
33; CHECK-NEXT:    [[COL_LOAD:%.*]] = load <9 x float>, ptr [[VEC_GEP]], align 4
34; CHECK-NEXT:    ret <9 x float> [[COL_LOAD]]
35;
36entry:
37  %load = call <9 x float> @llvm.matrix.column.major.load(ptr %in, i64 %stride, i1 false, i32 9, i32 1)
38  ret <9 x float> %load
39}
40
41declare <8 x float> @llvm.matrix.column.major.load.v8f32(ptr, i64, i1, i32, i32)
42
43define <8 x float> @strided_load_4x2(ptr %in, i64 %stride) {
44; CHECK-LABEL: @strided_load_4x2(
45; CHECK-NEXT:  entry:
46; CHECK-NEXT:    [[VEC_START:%.*]] = mul i64 0, [[STRIDE:%.*]]
47; CHECK-NEXT:    [[VEC_GEP:%.*]] = getelementptr float, ptr [[IN:%.*]], i64 [[VEC_START]]
48; CHECK-NEXT:    [[COL_LOAD:%.*]] = load <4 x float>, ptr [[VEC_GEP]], align 4
49; CHECK-NEXT:    [[VEC_START1:%.*]] = mul i64 1, [[STRIDE]]
50; CHECK-NEXT:    [[VEC_GEP2:%.*]] = getelementptr float, ptr [[IN]], i64 [[VEC_START1]]
51; CHECK-NEXT:    [[COL_LOAD4:%.*]] = load <4 x float>, ptr [[VEC_GEP2]], align 4
52; CHECK-NEXT:    [[TMP0:%.*]] = shufflevector <4 x float> [[COL_LOAD]], <4 x float> [[COL_LOAD4]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
53; CHECK-NEXT:    ret <8 x float> [[TMP0]]
54;
55entry:
56  %load = call <8 x float> @llvm.matrix.column.major.load.v8f32(ptr %in, i64 %stride, i1 false, i32 4, i32 2)
57  ret <8 x float> %load
58}
59