1; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
2
3define <4 x float> @transpose(<4 x float> %m, i32 %arg) {
4; CHECK: assembly parsed, but does not verify as correct!
5; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
6; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
7; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
8; CHECK-NEXT: immarg operand has non-immediate parameter
9; CHECK-NEXT: i32 %arg
10; CHECK-NEXT:   %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2)
11; CHECK-NEXT: immarg operand has non-immediate parameter
12; CHECK-NEXT: i32 %arg
13; CHECK-NEXT:   %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg)
14  %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %m, i32 0, i32 0)
15  %result.1 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.0, i32 3, i32 2)
16  %result.2 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.1, i32 2, i32 1)
17  %result.3 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.2, i32 %arg, i32 2)
18  %result.4 = call <4 x float> @llvm.matrix.transpose.v4f32(<4 x float> %result.3, i32 2, i32 %arg)
19  ret <4 x float> %result.4
20}
21
22define <4 x float> @multiply(<4 x float> %m, i32 %arg) {
23; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
24; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
25; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
26; CHECK-NEXT: immarg operand has non-immediate parameter
27; CHECK-NEXT: i32 %arg
28; CHECK-NEXT:   %result.3 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.2, <4 x float> %m, i32 %arg, i32 2, i32 1)
29  %result.0 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %m, <4 x float> %m, i32 0, i32 0, i32 0)
30  %result.1 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.0, <4 x float> %m, i32 3, i32 2, i32 2)
31  %result.2 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.1, <4 x float> %m, i32 2, i32 2, i32 1)
32  %result.3 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float> %result.2, <4 x float> %m, i32 %arg, i32 2, i32 1)
33  ret <4 x float> %result.3
34}
35
36define <4 x float> @column.major_load(float* %m, float* %n, i32 %arg) {
37; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
38; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
39; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
40; CHECK-NEXT: immarg operand has non-immediate parameter
41; CHECK-NEXT: i32 %arg
42; CHECK-NEXT:   %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg)
43  %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 0, i1 false, i32 0, i32 0)
44  %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 2, i1 false, i32 1, i32 2)
45  %result.2 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 3)
46  %result.3 = call <6 x float> @llvm.matrix.column.major.load.v6f32(float* %n, i64 2, i1 true, i32 3, i32 %arg)
47  ret <4 x float> %result.1
48}
49
50define void @column.major_store(float* %m, float* %n, i64 %arg) {
51; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
52; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
53; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
54; CHECK-NEXT: Result of a matrix operation does not fit in the returned vector!
55  call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 0, i1 false, i32 0, i32 0)
56  call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 2, i1 false, i32 1, i32 2)
57  call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 2, i1 false, i32 3, i32 3)
58  call void @llvm.matrix.column.major.store.v6f32(<6 x float> zeroinitializer, float* %n, i64 %arg, i1 false, i32 3, i32 3)
59  ret void
60}
61
62define <4 x float> @transpose_mixed_types(<4 x float> %fvec, <4 x i32> %ivec, i32 %arg) {
63;
64; CHECK-NEXT: Intrinsic has incorrect argument type!
65; CHECK-NEXT: <4 x float> (<4 x i32>, i32, i32)* @llvm.matrix.transpose.v4f32.v4i32
66; CHECK-NEXT: Intrinsic has incorrect argument type!
67; CHECK-NEXT: <4 x i32> (<4 x float>, i32, i32)* @llvm.matrix.transpose.v4i32.v4f32
68;
69  %result.0 = call <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32> %ivec, i32 0, i32 0)
70  %result.1 = call <4 x i32> @llvm.matrix.transpose.v4i32.v4f32(<4 x float> %result.0, i32 3, i32 2)
71  ret <4 x float> %result.0
72}
73
74define <4 x float> @multiply_mixed_types(<4 x i32> %ivec, <4 x float> %fvec, i32 %arg) {
75;
76; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!
77; CHECK-NEXT: <4 x i32> (<4 x float>, <4 x float>, i32, i32, i32)* @llvm.matrix.multiply.v4i32.v4f32.v4f32
78; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!
79; CHECK-NEXT: <4 x float> (<4 x i32>, <4 x float>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4i32.v4f32
80; CHECK-NEXT: Vector element type mismatch of the result and second operand vector!
81; CHECK-NEXT: <4 x float> (<4 x float>, <4 x i32>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4f32.v4i32
82; CHECK-NEXT: Vector element type mismatch of the result and first operand vector!
83; CHECK-NEXT: <4 x float> (<4 x i32>, <4 x i32>, i32, i32, i32)* @llvm.matrix.multiply.v4f32.v4i32.v4i32
84;
85  %result.0 = call <4 x i32> @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float> %fvec, <4 x float> %fvec, i32 2, i32 2, i32 2)
86  %result.1 = call <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32> %result.0, <4 x float> %fvec, i32 2, i32 2, i32 2)
87  %result.2 = call <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float> %fvec, <4 x i32> %ivec, i32 2, i32 2, i32 2)
88  %result.3 = call <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32> %ivec, <4 x i32> %ivec, i32 2, i32 2, i32 2)
89  ret <4 x float> %result.3
90}
91
92define <4 x float> @column.major_load_mixed_types(i32* %m, float* %n, i32 %arg) {
93;
94; CHECK-NEXT: Intrinsic has incorrect argument type!
95; CHECK-NEXT: <4 x float> (i32*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4f32.pi32
96; CHECK-NEXT: Intrinsic has incorrect argument type!
97; CHECK-NEXT: <4 x i32> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4i32
98;
99  %result.0 = call <4 x float> @llvm.matrix.column.major.load.v4f32.pi32(i32* %m, i64 2, i1 false, i32 2, i32 2)
100  %result.1 = call <4 x i32> @llvm.matrix.column.major.load.v4i32(float* %n, i64 2, i1 false, i32 2, i32 2)
101  ret <4 x float> %result.0
102}
103
104define void @column.major_store_mixed_types(float* %m, i32* %n, i64 %arg) {
105;
106; CHECK-NEXT: Intrinsic has incorrect argument type!
107; CHECK-NEXT: void (<4 x i32>, float*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4i32.vi32
108; CHECK-NEXT: Intrinsic has incorrect argument type!
109; CHECK-NEXT: void (<4 x float>, i32*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32.pi32
110;
111  call void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32> zeroinitializer, float* %m, i64 2, i1 false, i32 2, i32 2)
112  call void @llvm.matrix.column.major.store.v4f32.pi32(<4 x float> zeroinitializer, i32* %n, i64 2, i1 false, i32 2, i32 2)
113  ret void
114}
115
116define void @column.major_store_non_int_float_type(<4 x float>* %m, <4 x float>* %n, i64 %arg) {
117;
118; CHECK-NEXT: Intrinsic has incorrect argument type!
119; CHECK-NEXT: void (<4 x float*>, <4 x float>*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32p0.p0v4f32
120;
121  call void @llvm.matrix.column.major.store.v4f32p0.p0v4f32(<4 x float*> zeroinitializer, <4 x float>* %n, i64 2, i1 false, i32 2, i32 2)
122  ret void
123}
124
125define <4 x float> @column.major_load_stride_too_small(float* %m, i32 %arg) {
126;
127; CHECK-NEXT: Stride must be greater or equal than the number of rows!
128; CHECK-NEXT: <4 x float> (float*, i64, i1, i32, i32)* @llvm.matrix.column.major.load.v4f32
129;
130  %result.1 = call <4 x float> @llvm.matrix.column.major.load.v4f32(float* %m, i64 1, i1 false, i32 2, i32 2)
131  ret <4 x float> %result.1
132}
133
134define void @column.major_store_stride_too_small(float* %m, i64 %arg) {
135;
136; CHECK-NEXT: Stride must be greater or equal than the number of rows!
137; CHECK-NEXT: void (<4 x float>, float*, i64, i1, i32, i32)* @llvm.matrix.column.major.store.v4f32
138;
139  call void @llvm.matrix.column.major.store.v4f32(<4 x float> zeroinitializer, float* %m, i64 1, i1 false, i32 2, i32 2)
140  ret void
141}
142
143declare <4 x i32>   @llvm.matrix.column.major.load.v4i32(float*, i64, i1, i32, i32)
144declare <4 x float> @llvm.matrix.column.major.load.v4f32.pi32(i32*, i64, i1, i32, i32)
145declare <4 x float> @llvm.matrix.column.major.load.v4f32(float*, i64, i1, i32, i32)
146declare <6 x float> @llvm.matrix.column.major.load.v6f32(float*, i64, i1, i32, i32)
147
148declare void @llvm.matrix.column.major.store.v4f32(<4 x float>, float*, i64, i1, i32, i32)
149declare void @llvm.matrix.column.major.store.v6f32(<6 x float>, float*, i64, i1, i32, i32)
150declare void @llvm.matrix.column.major.store.v4i32.vi32(<4 x i32>, float*, i64, i1, i32, i32)
151declare void @llvm.matrix.column.major.store.v4f32.pi32(<4 x float>, i32*, i64, i1, i32, i32)
152declare void @llvm.matrix.column.major.store.v4f32p0.p0v4f32(<4 x float*>, <4 x float>*, i64, i1, i32, i32)
153
154declare <4 x i32>   @llvm.matrix.transpose.v4i32.v4f32(<4 x float>, i32, i32)
155declare <4 x float> @llvm.matrix.transpose.v4f32(<4 x float>, i32, i32)
156declare <4 x float> @llvm.matrix.transpose.v4f32.v4i32(<4 x i32>, i32, i32)
157
158declare <4 x i32>   @llvm.matrix.multiply.v4i32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32)
159declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4f32(<4 x i32>, <4 x float>, i32, i32, i32)
160declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4i32(<4 x float>, <4 x i32>, i32, i32, i32)
161declare <4 x float> @llvm.matrix.multiply.v4f32.v4i32.v4i32(<4 x i32>, <4 x i32>, i32, i32, i32)
162declare <4 x float> @llvm.matrix.multiply.v4f32.v4f32.v4f32(<4 x float>, <4 x float>, i32, i32, i32)
163