1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s
5 define <8 x i32> @transpose(<8 x i32> %a) {
6 ; CHECK-LABEL: @transpose(
8 ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> poison, <2 x i32> <i32 0, i32 1>
9 ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <2 x i32> <i32 2, i32 3>
10 ; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <2 x i32> <i32 4, i32 5>
11 ; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <8 x i32> [[A]], <8 x i32> poison, <2 x i32> <i32 6, i32 7>
12 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i32> [[SPLIT]], i64 0
13 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32> poison, i32 [[TMP0]], i64 0
14 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x i32> [[SPLIT1]], i64 0
15 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> [[TMP1]], i32 [[TMP2]], i64 1
16 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <2 x i32> [[SPLIT2]], i64 0
17 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> [[TMP3]], i32 [[TMP4]], i64 2
18 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[SPLIT3]], i64 0
19 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i32> [[TMP5]], i32 [[TMP6]], i64 3
20 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i32> [[SPLIT]], i64 1
21 ; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i32> poison, i32 [[TMP8]], i64 0
22 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <2 x i32> [[SPLIT1]], i64 1
23 ; CHECK-NEXT: [[TMP11:%.*]] = insertelement <4 x i32> [[TMP9]], i32 [[TMP10]], i64 1
24 ; CHECK-NEXT: [[TMP12:%.*]] = extractelement <2 x i32> [[SPLIT2]], i64 1
25 ; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i32> [[TMP11]], i32 [[TMP12]], i64 2
26 ; CHECK-NEXT: [[TMP14:%.*]] = extractelement <2 x i32> [[SPLIT3]], i64 1
27 ; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i32> [[TMP13]], i32 [[TMP14]], i64 3
28 ; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <4 x i32> [[TMP7]], <4 x i32> [[TMP15]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
29 ; CHECK-NEXT: ret <8 x i32> [[TMP16]]
32 %c = call <8 x i32> @llvm.matrix.transpose(<8 x i32> %a, i32 2, i32 4)
36 declare <8 x i32> @llvm.matrix.transpose(<8 x i32>, i32, i32)
38 define <8 x i32> @transpose_single_column(<8 x i32> %a) {
39 ; CHECK-LABEL: @transpose_single_column(
41 ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <8 x i32> [[A:%.*]], <8 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
42 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 0
43 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <1 x i32> poison, i32 [[TMP0]], i64 0
44 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 1
45 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <1 x i32> poison, i32 [[TMP2]], i64 0
46 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 2
47 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <1 x i32> poison, i32 [[TMP4]], i64 0
48 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 3
49 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <1 x i32> poison, i32 [[TMP6]], i64 0
50 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 4
51 ; CHECK-NEXT: [[TMP9:%.*]] = insertelement <1 x i32> poison, i32 [[TMP8]], i64 0
52 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 5
53 ; CHECK-NEXT: [[TMP11:%.*]] = insertelement <1 x i32> poison, i32 [[TMP10]], i64 0
54 ; CHECK-NEXT: [[TMP12:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 6
55 ; CHECK-NEXT: [[TMP13:%.*]] = insertelement <1 x i32> poison, i32 [[TMP12]], i64 0
56 ; CHECK-NEXT: [[TMP14:%.*]] = extractelement <8 x i32> [[SPLIT]], i64 7
57 ; CHECK-NEXT: [[TMP15:%.*]] = insertelement <1 x i32> poison, i32 [[TMP14]], i64 0
58 ; CHECK-NEXT: [[TMP16:%.*]] = shufflevector <1 x i32> [[TMP1]], <1 x i32> [[TMP3]], <2 x i32> <i32 0, i32 1>
59 ; CHECK-NEXT: [[TMP17:%.*]] = shufflevector <1 x i32> [[TMP5]], <1 x i32> [[TMP7]], <2 x i32> <i32 0, i32 1>
60 ; CHECK-NEXT: [[TMP18:%.*]] = shufflevector <1 x i32> [[TMP9]], <1 x i32> [[TMP11]], <2 x i32> <i32 0, i32 1>
61 ; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <1 x i32> [[TMP13]], <1 x i32> [[TMP15]], <2 x i32> <i32 0, i32 1>
62 ; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <2 x i32> [[TMP16]], <2 x i32> [[TMP17]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
63 ; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <2 x i32> [[TMP18]], <2 x i32> [[TMP19]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
64 ; CHECK-NEXT: [[TMP22:%.*]] = shufflevector <4 x i32> [[TMP20]], <4 x i32> [[TMP21]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
65 ; CHECK-NEXT: ret <8 x i32> [[TMP22]]
68 %c = call <8 x i32> @llvm.matrix.transpose(<8 x i32> %a, i32 8, i32 1)
72 declare <12 x i32> @llvm.matrix.transpose.v12i32(<12 x i32>, i32, i32)
74 define <12 x i32> @transpose_i32_3x4(<12 x i32> %a) {
75 ; CHECK-LABEL: @transpose_i32_3x4(
77 ; CHECK-NEXT: [[SPLIT:%.*]] = shufflevector <12 x i32> [[A:%.*]], <12 x i32> poison, <3 x i32> <i32 0, i32 1, i32 2>
78 ; CHECK-NEXT: [[SPLIT1:%.*]] = shufflevector <12 x i32> [[A]], <12 x i32> poison, <3 x i32> <i32 3, i32 4, i32 5>
79 ; CHECK-NEXT: [[SPLIT2:%.*]] = shufflevector <12 x i32> [[A]], <12 x i32> poison, <3 x i32> <i32 6, i32 7, i32 8>
80 ; CHECK-NEXT: [[SPLIT3:%.*]] = shufflevector <12 x i32> [[A]], <12 x i32> poison, <3 x i32> <i32 9, i32 10, i32 11>
81 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <3 x i32> [[SPLIT]], i64 0
82 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <4 x i32> poison, i32 [[TMP0]], i64 0
83 ; CHECK-NEXT: [[TMP2:%.*]] = extractelement <3 x i32> [[SPLIT1]], i64 0
84 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> [[TMP1]], i32 [[TMP2]], i64 1
85 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <3 x i32> [[SPLIT2]], i64 0
86 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> [[TMP3]], i32 [[TMP4]], i64 2
87 ; CHECK-NEXT: [[TMP6:%.*]] = extractelement <3 x i32> [[SPLIT3]], i64 0
88 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <4 x i32> [[TMP5]], i32 [[TMP6]], i64 3
89 ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <3 x i32> [[SPLIT]], i64 1
90 ; CHECK-NEXT: [[TMP9:%.*]] = insertelement <4 x i32> poison, i32 [[TMP8]], i64 0
91 ; CHECK-NEXT: [[TMP10:%.*]] = extractelement <3 x i32> [[SPLIT1]], i64 1
92 ; CHECK-NEXT: [[TMP11:%.*]] = insertelement <4 x i32> [[TMP9]], i32 [[TMP10]], i64 1
93 ; CHECK-NEXT: [[TMP12:%.*]] = extractelement <3 x i32> [[SPLIT2]], i64 1
94 ; CHECK-NEXT: [[TMP13:%.*]] = insertelement <4 x i32> [[TMP11]], i32 [[TMP12]], i64 2
95 ; CHECK-NEXT: [[TMP14:%.*]] = extractelement <3 x i32> [[SPLIT3]], i64 1
96 ; CHECK-NEXT: [[TMP15:%.*]] = insertelement <4 x i32> [[TMP13]], i32 [[TMP14]], i64 3
97 ; CHECK-NEXT: [[TMP16:%.*]] = extractelement <3 x i32> [[SPLIT]], i64 2
98 ; CHECK-NEXT: [[TMP17:%.*]] = insertelement <4 x i32> poison, i32 [[TMP16]], i64 0
99 ; CHECK-NEXT: [[TMP18:%.*]] = extractelement <3 x i32> [[SPLIT1]], i64 2
100 ; CHECK-NEXT: [[TMP19:%.*]] = insertelement <4 x i32> [[TMP17]], i32 [[TMP18]], i64 1
101 ; CHECK-NEXT: [[TMP20:%.*]] = extractelement <3 x i32> [[SPLIT2]], i64 2
102 ; CHECK-NEXT: [[TMP21:%.*]] = insertelement <4 x i32> [[TMP19]], i32 [[TMP20]], i64 2
103 ; CHECK-NEXT: [[TMP22:%.*]] = extractelement <3 x i32> [[SPLIT3]], i64 2
104 ; CHECK-NEXT: [[TMP23:%.*]] = insertelement <4 x i32> [[TMP21]], i32 [[TMP22]], i64 3
105 ; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <4 x i32> [[TMP7]], <4 x i32> [[TMP15]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
106 ; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <4 x i32> [[TMP23]], <4 x i32> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
107 ; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <8 x i32> [[TMP24]], <8 x i32> [[TMP25]], <12 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
108 ; CHECK-NEXT: ret <12 x i32> [[TMP26]]
111 %c = call <12 x i32> @llvm.matrix.transpose.v12i32(<12 x i32> %a, i32 3, i32 4)