1 ; Test the MSA intrinsics that are encoded with the I5 instruction format.
2 ; There are lots of these so this covers those beginning with 'm'
4 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
5 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
7 @llvm_mips_maxi_s_b_ARG1 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, align 16
8 @llvm_mips_maxi_s_b_RES1 = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
9 @llvm_mips_maxi_s_b_RES2 = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
11 define void @llvm_mips_maxi_s_b_test() nounwind {
13 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_maxi_s_b_ARG1
14 %1 = tail call <16 x i8> @llvm.mips.maxi.s.b(<16 x i8> %0, i32 14)
15 store <16 x i8> %1, <16 x i8>* @llvm_mips_maxi_s_b_RES1
16 %2 = tail call <16 x i8> @llvm.mips.maxi.s.b(<16 x i8> %0, i32 -14)
17 store <16 x i8> %2, <16 x i8>* @llvm_mips_maxi_s_b_RES2
21 declare <16 x i8> @llvm.mips.maxi.s.b(<16 x i8>, i32) nounwind
23 ; CHECK: llvm_mips_maxi_s_b_test:
24 ; CHECK: ld.b [[RS:\$w[0-9]+]]
25 ; CHECK: maxi_s.b [[RD1:\$w[0-9]]], [[RS]], 14
27 ; CHECK: maxi_s.b [[RD2:\$w[0-9]]], [[RS]], -14
29 ; CHECK: .size llvm_mips_maxi_s_b_test
31 @llvm_mips_maxi_s_h_ARG1 = global <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, align 16
32 @llvm_mips_maxi_s_h_RES1 = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
33 @llvm_mips_maxi_s_h_RES2 = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
35 define void @llvm_mips_maxi_s_h_test() nounwind {
37 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_maxi_s_h_ARG1
38 %1 = tail call <8 x i16> @llvm.mips.maxi.s.h(<8 x i16> %0, i32 14)
39 store <8 x i16> %1, <8 x i16>* @llvm_mips_maxi_s_h_RES1
40 %2 = tail call <8 x i16> @llvm.mips.maxi.s.h(<8 x i16> %0, i32 -14)
41 store <8 x i16> %2, <8 x i16>* @llvm_mips_maxi_s_h_RES2
45 declare <8 x i16> @llvm.mips.maxi.s.h(<8 x i16>, i32) nounwind
47 ; CHECK: llvm_mips_maxi_s_h_test:
48 ; CHECK: ld.h [[RS:\$w[0-9]+]]
49 ; CHECK: maxi_s.h [[RD1:\$w[0-9]]], [[RS]], 14
51 ; CHECK: maxi_s.h [[RD2:\$w[0-9]]], [[RS]], -14
53 ; CHECK: .size llvm_mips_maxi_s_h_test
55 @llvm_mips_maxi_s_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
56 @llvm_mips_maxi_s_w_RES1 = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
57 @llvm_mips_maxi_s_w_RES2 = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
59 define void @llvm_mips_maxi_s_w_test() nounwind {
61 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_maxi_s_w_ARG1
62 %1 = tail call <4 x i32> @llvm.mips.maxi.s.w(<4 x i32> %0, i32 14)
63 store <4 x i32> %1, <4 x i32>* @llvm_mips_maxi_s_w_RES1
64 %2 = tail call <4 x i32> @llvm.mips.maxi.s.w(<4 x i32> %0, i32 -14)
65 store <4 x i32> %2, <4 x i32>* @llvm_mips_maxi_s_w_RES2
69 declare <4 x i32> @llvm.mips.maxi.s.w(<4 x i32>, i32) nounwind
71 ; CHECK: llvm_mips_maxi_s_w_test:
72 ; CHECK: ld.w [[RS:\$w[0-9]+]]
73 ; CHECK: maxi_s.w [[RD1:\$w[0-9]]], [[RS]], 14
75 ; CHECK: maxi_s.w [[RD2:\$w[0-9]]], [[RS]], -14
77 ; CHECK: .size llvm_mips_maxi_s_w_test
79 @llvm_mips_maxi_s_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
80 @llvm_mips_maxi_s_d_RES1 = global <2 x i64> <i64 0, i64 0>, align 16
81 @llvm_mips_maxi_s_d_RES2 = global <2 x i64> <i64 0, i64 0>, align 16
83 define void @llvm_mips_maxi_s_d_test() nounwind {
85 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_maxi_s_d_ARG1
86 %1 = tail call <2 x i64> @llvm.mips.maxi.s.d(<2 x i64> %0, i32 14)
87 store <2 x i64> %1, <2 x i64>* @llvm_mips_maxi_s_d_RES1
88 %2 = tail call <2 x i64> @llvm.mips.maxi.s.d(<2 x i64> %0, i32 -14)
89 store <2 x i64> %2, <2 x i64>* @llvm_mips_maxi_s_d_RES2
93 declare <2 x i64> @llvm.mips.maxi.s.d(<2 x i64>, i32) nounwind
95 ; CHECK: llvm_mips_maxi_s_d_test:
96 ; CHECK: ld.d [[RS:\$w[0-9]+]]
97 ; CHECK: maxi_s.d [[RD1:\$w[0-9]]], [[RS]], 14
99 ; CHECK: maxi_s.d [[RD2:\$w[0-9]]], [[RS]], -14
100 ; CHECK: st.d [[RD2]]
101 ; CHECK: .size llvm_mips_maxi_s_d_test
103 @llvm_mips_maxi_u_b_ARG1 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, align 16
104 @llvm_mips_maxi_u_b_RES = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
106 define void @llvm_mips_maxi_u_b_test() nounwind {
108 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_maxi_u_b_ARG1
109 %1 = tail call <16 x i8> @llvm.mips.maxi.u.b(<16 x i8> %0, i32 14)
110 store <16 x i8> %1, <16 x i8>* @llvm_mips_maxi_u_b_RES
114 declare <16 x i8> @llvm.mips.maxi.u.b(<16 x i8>, i32) nounwind
116 ; CHECK: llvm_mips_maxi_u_b_test:
120 ; CHECK: .size llvm_mips_maxi_u_b_test
122 @llvm_mips_maxi_u_h_ARG1 = global <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, align 16
123 @llvm_mips_maxi_u_h_RES = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
125 define void @llvm_mips_maxi_u_h_test() nounwind {
127 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_maxi_u_h_ARG1
128 %1 = tail call <8 x i16> @llvm.mips.maxi.u.h(<8 x i16> %0, i32 14)
129 store <8 x i16> %1, <8 x i16>* @llvm_mips_maxi_u_h_RES
133 declare <8 x i16> @llvm.mips.maxi.u.h(<8 x i16>, i32) nounwind
135 ; CHECK: llvm_mips_maxi_u_h_test:
139 ; CHECK: .size llvm_mips_maxi_u_h_test
141 @llvm_mips_maxi_u_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
142 @llvm_mips_maxi_u_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
144 define void @llvm_mips_maxi_u_w_test() nounwind {
146 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_maxi_u_w_ARG1
147 %1 = tail call <4 x i32> @llvm.mips.maxi.u.w(<4 x i32> %0, i32 14)
148 store <4 x i32> %1, <4 x i32>* @llvm_mips_maxi_u_w_RES
152 declare <4 x i32> @llvm.mips.maxi.u.w(<4 x i32>, i32) nounwind
154 ; CHECK: llvm_mips_maxi_u_w_test:
158 ; CHECK: .size llvm_mips_maxi_u_w_test
160 @llvm_mips_maxi_u_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
161 @llvm_mips_maxi_u_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
163 define void @llvm_mips_maxi_u_d_test() nounwind {
165 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_maxi_u_d_ARG1
166 %1 = tail call <2 x i64> @llvm.mips.maxi.u.d(<2 x i64> %0, i32 14)
167 store <2 x i64> %1, <2 x i64>* @llvm_mips_maxi_u_d_RES
171 declare <2 x i64> @llvm.mips.maxi.u.d(<2 x i64>, i32) nounwind
173 ; CHECK: llvm_mips_maxi_u_d_test:
177 ; CHECK: .size llvm_mips_maxi_u_d_test
179 @llvm_mips_mini_s_b_ARG1 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, align 16
180 @llvm_mips_mini_s_b_RES1 = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
181 @llvm_mips_mini_s_b_RES2 = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
183 define void @llvm_mips_mini_s_b_test() nounwind {
185 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_mini_s_b_ARG1
186 %1 = tail call <16 x i8> @llvm.mips.mini.s.b(<16 x i8> %0, i32 14)
187 store <16 x i8> %1, <16 x i8>* @llvm_mips_mini_s_b_RES1
188 %2 = tail call <16 x i8> @llvm.mips.mini.s.b(<16 x i8> %0, i32 -14)
189 store <16 x i8> %2, <16 x i8>* @llvm_mips_mini_s_b_RES2
193 declare <16 x i8> @llvm.mips.mini.s.b(<16 x i8>, i32) nounwind
195 ; CHECK: llvm_mips_mini_s_b_test:
196 ; CHECK: ld.b [[RS:\$w[0-9]+]]
197 ; CHECK: mini_s.b [[RD1:\$w[0-9]]], [[RS]], 14
198 ; CHECK: st.b [[RD1]]
199 ; CHECK: mini_s.b [[RD2:\$w[0-9]]], [[RS]], -14
200 ; CHECK: st.b [[RD2]]
201 ; CHECK: .size llvm_mips_mini_s_b_test
203 @llvm_mips_mini_s_h_ARG1 = global <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, align 16
204 @llvm_mips_mini_s_h_RES1 = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
205 @llvm_mips_mini_s_h_RES2 = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
207 define void @llvm_mips_mini_s_h_test() nounwind {
209 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_mini_s_h_ARG1
210 %1 = tail call <8 x i16> @llvm.mips.mini.s.h(<8 x i16> %0, i32 14)
211 store <8 x i16> %1, <8 x i16>* @llvm_mips_mini_s_h_RES1
212 %2 = tail call <8 x i16> @llvm.mips.mini.s.h(<8 x i16> %0, i32 -14)
213 store <8 x i16> %2, <8 x i16>* @llvm_mips_mini_s_h_RES2
217 declare <8 x i16> @llvm.mips.mini.s.h(<8 x i16>, i32) nounwind
219 ; CHECK: llvm_mips_mini_s_h_test:
220 ; CHECK: ld.h [[RS:\$w[0-9]+]]
221 ; CHECK: mini_s.h [[RD1:\$w[0-9]]], [[RS]], 14
222 ; CHECK: st.h [[RD1]]
223 ; CHECK: mini_s.h [[RD2:\$w[0-9]]], [[RS]], -14
224 ; CHECK: st.h [[RD2]]
225 ; CHECK: .size llvm_mips_mini_s_h_test
227 @llvm_mips_mini_s_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
228 @llvm_mips_mini_s_w_RES1 = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
229 @llvm_mips_mini_s_w_RES2 = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
231 define void @llvm_mips_mini_s_w_test() nounwind {
233 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_mini_s_w_ARG1
234 %1 = tail call <4 x i32> @llvm.mips.mini.s.w(<4 x i32> %0, i32 14)
235 store <4 x i32> %1, <4 x i32>* @llvm_mips_mini_s_w_RES1
236 %2 = tail call <4 x i32> @llvm.mips.mini.s.w(<4 x i32> %0, i32 -14)
237 store <4 x i32> %2, <4 x i32>* @llvm_mips_mini_s_w_RES2
241 declare <4 x i32> @llvm.mips.mini.s.w(<4 x i32>, i32) nounwind
243 ; CHECK: llvm_mips_mini_s_w_test:
244 ; CHECK: ld.w [[RS:\$w[0-9]+]]
245 ; CHECK: mini_s.w [[RD1:\$w[0-9]]], [[RS]], 14
246 ; CHECK: st.w [[RD1]]
247 ; CHECK: mini_s.w [[RD2:\$w[0-9]]], [[RS]], -14
248 ; CHECK: st.w [[RD2]]
249 ; CHECK: .size llvm_mips_mini_s_w_test
251 @llvm_mips_mini_s_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
252 @llvm_mips_mini_s_d_RES1 = global <2 x i64> <i64 0, i64 0>, align 16
253 @llvm_mips_mini_s_d_RES2 = global <2 x i64> <i64 0, i64 0>, align 16
255 define void @llvm_mips_mini_s_d_test() nounwind {
257 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_mini_s_d_ARG1
258 %1 = tail call <2 x i64> @llvm.mips.mini.s.d(<2 x i64> %0, i32 14)
259 store <2 x i64> %1, <2 x i64>* @llvm_mips_mini_s_d_RES1
260 %2 = tail call <2 x i64> @llvm.mips.mini.s.d(<2 x i64> %0, i32 -14)
261 store <2 x i64> %2, <2 x i64>* @llvm_mips_mini_s_d_RES2
265 declare <2 x i64> @llvm.mips.mini.s.d(<2 x i64>, i32) nounwind
267 ; CHECK: llvm_mips_mini_s_d_test:
268 ; CHECK: ld.d [[RS:\$w[0-9]+]]
269 ; CHECK: mini_s.d [[RD1:\$w[0-9]]], [[RS]], 14
270 ; CHECK: st.d [[RD1]]
271 ; CHECK: mini_s.d [[RD2:\$w[0-9]]], [[RS]], -14
272 ; CHECK: st.d [[RD2]]
273 ; CHECK: .size llvm_mips_mini_s_d_test
275 @llvm_mips_mini_u_b_ARG1 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, align 16
276 @llvm_mips_mini_u_b_RES = global <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>, align 16
278 define void @llvm_mips_mini_u_b_test() nounwind {
280 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_mini_u_b_ARG1
281 %1 = tail call <16 x i8> @llvm.mips.mini.u.b(<16 x i8> %0, i32 14)
282 store <16 x i8> %1, <16 x i8>* @llvm_mips_mini_u_b_RES
286 declare <16 x i8> @llvm.mips.mini.u.b(<16 x i8>, i32) nounwind
288 ; CHECK: llvm_mips_mini_u_b_test:
292 ; CHECK: .size llvm_mips_mini_u_b_test
294 @llvm_mips_mini_u_h_ARG1 = global <8 x i16> <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7>, align 16
295 @llvm_mips_mini_u_h_RES = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
297 define void @llvm_mips_mini_u_h_test() nounwind {
299 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_mini_u_h_ARG1
300 %1 = tail call <8 x i16> @llvm.mips.mini.u.h(<8 x i16> %0, i32 14)
301 store <8 x i16> %1, <8 x i16>* @llvm_mips_mini_u_h_RES
305 declare <8 x i16> @llvm.mips.mini.u.h(<8 x i16>, i32) nounwind
307 ; CHECK: llvm_mips_mini_u_h_test:
311 ; CHECK: .size llvm_mips_mini_u_h_test
313 @llvm_mips_mini_u_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
314 @llvm_mips_mini_u_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
316 define void @llvm_mips_mini_u_w_test() nounwind {
318 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_mini_u_w_ARG1
319 %1 = tail call <4 x i32> @llvm.mips.mini.u.w(<4 x i32> %0, i32 14)
320 store <4 x i32> %1, <4 x i32>* @llvm_mips_mini_u_w_RES
324 declare <4 x i32> @llvm.mips.mini.u.w(<4 x i32>, i32) nounwind
326 ; CHECK: llvm_mips_mini_u_w_test:
330 ; CHECK: .size llvm_mips_mini_u_w_test
332 @llvm_mips_mini_u_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
333 @llvm_mips_mini_u_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
335 define void @llvm_mips_mini_u_d_test() nounwind {
337 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_mini_u_d_ARG1
338 %1 = tail call <2 x i64> @llvm.mips.mini.u.d(<2 x i64> %0, i32 14)
339 store <2 x i64> %1, <2 x i64>* @llvm_mips_mini_u_d_RES
343 declare <2 x i64> @llvm.mips.mini.u.d(<2 x i64>, i32) nounwind
345 ; CHECK: llvm_mips_mini_u_d_test:
349 ; CHECK: .size llvm_mips_mini_u_d_test