1 ; Test the MSA intrinsics that are encoded with the 3R instruction format and
2 ; use the result as a third operand and results in wider elements than the
5 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
6 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 < %s | FileCheck %s
8 @llvm_mips_dpadd_s_h_ARG2 = global <16 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23>, align 16
9 @llvm_mips_dpadd_s_h_ARG3 = global <16 x i8> <i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39>, align 16
10 @llvm_mips_dpadd_s_h_RES = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
12 define void @llvm_mips_dpadd_s_h_test() nounwind {
14 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_dpadd_s_h_ARG2
15 %1 = load <16 x i8>, <16 x i8>* @llvm_mips_dpadd_s_h_ARG3
16 %2 = tail call <8 x i16> @llvm.mips.dpadd.s.h(<8 x i16> <i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4>, <16 x i8> %0, <16 x i8> %1)
17 store <8 x i16> %2, <8 x i16>* @llvm_mips_dpadd_s_h_RES
21 declare <8 x i16> @llvm.mips.dpadd.s.h(<8 x i16>, <16 x i8>, <16 x i8>) nounwind
23 ; CHECK: llvm_mips_dpadd_s_h_test:
26 ; CHECK: ldi.h [[R1:\$w[0-9]+]],
27 ; CHECK: dpadd_s.h [[R1]],
29 ; CHECK: .size llvm_mips_dpadd_s_h_test
31 @llvm_mips_dpadd_s_w_ARG2 = global <8 x i16> <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11>, align 16
32 @llvm_mips_dpadd_s_w_ARG3 = global <8 x i16> <i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>, align 16
33 @llvm_mips_dpadd_s_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
35 define void @llvm_mips_dpadd_s_w_test() nounwind {
37 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_dpadd_s_w_ARG2
38 %1 = load <8 x i16>, <8 x i16>* @llvm_mips_dpadd_s_w_ARG3
39 %2 = tail call <4 x i32> @llvm.mips.dpadd.s.w(<4 x i32> <i32 4, i32 4, i32 4, i32 4>, <8 x i16> %0, <8 x i16> %1)
40 store <4 x i32> %2, <4 x i32>* @llvm_mips_dpadd_s_w_RES
44 declare <4 x i32> @llvm.mips.dpadd.s.w(<4 x i32>, <8 x i16>, <8 x i16>) nounwind
46 ; CHECK: llvm_mips_dpadd_s_w_test:
49 ; CHECK: ldi.w [[R1:\$w[0-9]+]],
50 ; CHECK: dpadd_s.w [[R1]],
52 ; CHECK: .size llvm_mips_dpadd_s_w_test
54 @llvm_mips_dpadd_s_d_ARG2 = global <4 x i32> <i32 2, i32 3, i32 4, i32 5>, align 16
55 @llvm_mips_dpadd_s_d_ARG3 = global <4 x i32> <i32 6, i32 7, i32 8, i32 9>, align 16
56 @llvm_mips_dpadd_s_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
58 define void @llvm_mips_dpadd_s_d_test() nounwind {
60 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_dpadd_s_d_ARG2
61 %1 = load <4 x i32>, <4 x i32>* @llvm_mips_dpadd_s_d_ARG3
62 %2 = tail call <2 x i64> @llvm.mips.dpadd.s.d(<2 x i64> <i64 4, i64 4>, <4 x i32> %0, <4 x i32> %1)
63 store <2 x i64> %2, <2 x i64>* @llvm_mips_dpadd_s_d_RES
67 declare <2 x i64> @llvm.mips.dpadd.s.d(<2 x i64>, <4 x i32>, <4 x i32>) nounwind
69 ; CHECK: llvm_mips_dpadd_s_d_test:
70 ; CHECK: ldi.d [[R1:\$w[0-9]+]],
73 ; CHECK: dpadd_s.d [[R1]],
75 ; CHECK: .size llvm_mips_dpadd_s_d_test
77 @llvm_mips_dpadd_u_h_ARG2 = global <16 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23>, align 16
78 @llvm_mips_dpadd_u_h_ARG3 = global <16 x i8> <i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39>, align 16
79 @llvm_mips_dpadd_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
81 define void @llvm_mips_dpadd_u_h_test() nounwind {
83 %0 = load <16 x i8>, <16 x i8>* @llvm_mips_dpadd_u_h_ARG2
84 %1 = load <16 x i8>, <16 x i8>* @llvm_mips_dpadd_u_h_ARG3
85 %2 = tail call <8 x i16> @llvm.mips.dpadd.u.h(<8 x i16> <i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4, i16 4>, <16 x i8> %0, <16 x i8> %1)
86 store <8 x i16> %2, <8 x i16>* @llvm_mips_dpadd_u_h_RES
90 declare <8 x i16> @llvm.mips.dpadd.u.h(<8 x i16>, <16 x i8>, <16 x i8>) nounwind
92 ; CHECK: llvm_mips_dpadd_u_h_test:
95 ; CHECK: ldi.h [[R1:\$w[0-9]+]],
96 ; CHECK: dpadd_u.h [[R1]],
98 ; CHECK: .size llvm_mips_dpadd_u_h_test
100 @llvm_mips_dpadd_u_w_ARG2 = global <8 x i16> <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11>, align 16
101 @llvm_mips_dpadd_u_w_ARG3 = global <8 x i16> <i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>, align 16
102 @llvm_mips_dpadd_u_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
104 define void @llvm_mips_dpadd_u_w_test() nounwind {
106 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_dpadd_u_w_ARG2
107 %1 = load <8 x i16>, <8 x i16>* @llvm_mips_dpadd_u_w_ARG3
108 %2 = tail call <4 x i32> @llvm.mips.dpadd.u.w(<4 x i32> <i32 4, i32 4, i32 4, i32 4>, <8 x i16> %0, <8 x i16> %1)
109 store <4 x i32> %2, <4 x i32>* @llvm_mips_dpadd_u_w_RES
113 declare <4 x i32> @llvm.mips.dpadd.u.w(<4 x i32>, <8 x i16>, <8 x i16>) nounwind
115 ; CHECK: llvm_mips_dpadd_u_w_test:
118 ; CHECK: ldi.w [[R1:\$w[0-9]+]],
119 ; CHECK: dpadd_u.w [[R1]],
121 ; CHECK: .size llvm_mips_dpadd_u_w_test
123 @llvm_mips_dpadd_u_d_ARG2 = global <4 x i32> <i32 2, i32 3, i32 4, i32 5>, align 16
124 @llvm_mips_dpadd_u_d_ARG3 = global <4 x i32> <i32 6, i32 7, i32 8, i32 9>, align 16
125 @llvm_mips_dpadd_u_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
127 define void @llvm_mips_dpadd_u_d_test() nounwind {
129 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_dpadd_u_d_ARG2
130 %1 = load <4 x i32>, <4 x i32>* @llvm_mips_dpadd_u_d_ARG3
131 %2 = tail call <2 x i64> @llvm.mips.dpadd.u.d(<2 x i64> <i64 4, i64 4>, <4 x i32> %0, <4 x i32> %1)
132 store <2 x i64> %2, <2 x i64>* @llvm_mips_dpadd_u_d_RES
136 declare <2 x i64> @llvm.mips.dpadd.u.d(<2 x i64>, <4 x i32>, <4 x i32>) nounwind
138 ; CHECK: llvm_mips_dpadd_u_d_test:
139 ; CHECK: ldi.d [[R1:\$w[0-9]+]],
142 ; CHECK: dpadd_u.d [[R1]],
144 ; CHECK: .size llvm_mips_dpadd_u_d_test
146 @llvm_mips_dpsub_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
147 @llvm_mips_dpsub_s_h_ARG2 = global <16 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23>, align 16
148 @llvm_mips_dpsub_s_h_ARG3 = global <16 x i8> <i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39>, align 16
149 @llvm_mips_dpsub_s_h_RES = global <8 x i16> <i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, align 16
151 define void @llvm_mips_dpsub_s_h_test() nounwind {
153 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_s_h_ARG1
154 %1 = load <16 x i8>, <16 x i8>* @llvm_mips_dpsub_s_h_ARG2
155 %2 = load <16 x i8>, <16 x i8>* @llvm_mips_dpsub_s_h_ARG3
156 %3 = tail call <8 x i16> @llvm.mips.dpsub.s.h(<8 x i16> %0, <16 x i8> %1, <16 x i8> %2)
157 store <8 x i16> %3, <8 x i16>* @llvm_mips_dpsub_s_h_RES
161 declare <8 x i16> @llvm.mips.dpsub.s.h(<8 x i16>, <16 x i8>, <16 x i8>) nounwind
163 ; CHECK: llvm_mips_dpsub_s_h_test:
169 ; CHECK: .size llvm_mips_dpsub_s_h_test
171 @llvm_mips_dpsub_s_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
172 @llvm_mips_dpsub_s_w_ARG2 = global <8 x i16> <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11>, align 16
173 @llvm_mips_dpsub_s_w_ARG3 = global <8 x i16> <i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>, align 16
174 @llvm_mips_dpsub_s_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
176 define void @llvm_mips_dpsub_s_w_test() nounwind {
178 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_s_w_ARG1
179 %1 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_s_w_ARG2
180 %2 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_s_w_ARG3
181 %3 = tail call <4 x i32> @llvm.mips.dpsub.s.w(<4 x i32> %0, <8 x i16> %1, <8 x i16> %2)
182 store <4 x i32> %3, <4 x i32>* @llvm_mips_dpsub_s_w_RES
186 declare <4 x i32> @llvm.mips.dpsub.s.w(<4 x i32>, <8 x i16>, <8 x i16>) nounwind
188 ; CHECK: llvm_mips_dpsub_s_w_test:
194 ; CHECK: .size llvm_mips_dpsub_s_w_test
196 @llvm_mips_dpsub_s_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
197 @llvm_mips_dpsub_s_d_ARG2 = global <4 x i32> <i32 2, i32 3, i32 4, i32 5>, align 16
198 @llvm_mips_dpsub_s_d_ARG3 = global <4 x i32> <i32 6, i32 7, i32 8, i32 9>, align 16
199 @llvm_mips_dpsub_s_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
201 define void @llvm_mips_dpsub_s_d_test() nounwind {
203 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_dpsub_s_d_ARG1
204 %1 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_s_d_ARG2
205 %2 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_s_d_ARG3
206 %3 = tail call <2 x i64> @llvm.mips.dpsub.s.d(<2 x i64> %0, <4 x i32> %1, <4 x i32> %2)
207 store <2 x i64> %3, <2 x i64>* @llvm_mips_dpsub_s_d_RES
211 declare <2 x i64> @llvm.mips.dpsub.s.d(<2 x i64>, <4 x i32>, <4 x i32>) nounwind
213 ; CHECK: llvm_mips_dpsub_s_d_test:
219 ; CHECK: .size llvm_mips_dpsub_s_d_test
221 @llvm_mips_dpsub_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
222 @llvm_mips_dpsub_u_h_ARG2 = global <16 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23>, align 16
223 @llvm_mips_dpsub_u_h_ARG3 = global <16 x i8> <i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31, i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39>, align 16
224 @llvm_mips_dpsub_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
226 define void @llvm_mips_dpsub_u_h_test() nounwind {
228 %0 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_u_h_ARG1
229 %1 = load <16 x i8>, <16 x i8>* @llvm_mips_dpsub_u_h_ARG2
230 %2 = load <16 x i8>, <16 x i8>* @llvm_mips_dpsub_u_h_ARG3
231 %3 = tail call <8 x i16> @llvm.mips.dpsub.u.h(<8 x i16> %0, <16 x i8> %1, <16 x i8> %2)
232 store <8 x i16> %3, <8 x i16>* @llvm_mips_dpsub_u_h_RES
236 declare <8 x i16> @llvm.mips.dpsub.u.h(<8 x i16>, <16 x i8>, <16 x i8>) nounwind
238 ; CHECK: llvm_mips_dpsub_u_h_test:
244 ; CHECK: .size llvm_mips_dpsub_u_h_test
246 @llvm_mips_dpsub_u_w_ARG1 = global <4 x i32> <i32 0, i32 1, i32 2, i32 3>, align 16
247 @llvm_mips_dpsub_u_w_ARG2 = global <8 x i16> <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11>, align 16
248 @llvm_mips_dpsub_u_w_ARG3 = global <8 x i16> <i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>, align 16
249 @llvm_mips_dpsub_u_w_RES = global <4 x i32> <i32 0, i32 0, i32 0, i32 0>, align 16
251 define void @llvm_mips_dpsub_u_w_test() nounwind {
253 %0 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_u_w_ARG1
254 %1 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_u_w_ARG2
255 %2 = load <8 x i16>, <8 x i16>* @llvm_mips_dpsub_u_w_ARG3
256 %3 = tail call <4 x i32> @llvm.mips.dpsub.u.w(<4 x i32> %0, <8 x i16> %1, <8 x i16> %2)
257 store <4 x i32> %3, <4 x i32>* @llvm_mips_dpsub_u_w_RES
261 declare <4 x i32> @llvm.mips.dpsub.u.w(<4 x i32>, <8 x i16>, <8 x i16>) nounwind
263 ; CHECK: llvm_mips_dpsub_u_w_test:
269 ; CHECK: .size llvm_mips_dpsub_u_w_test
271 @llvm_mips_dpsub_u_d_ARG1 = global <2 x i64> <i64 0, i64 1>, align 16
272 @llvm_mips_dpsub_u_d_ARG2 = global <4 x i32> <i32 2, i32 3, i32 4, i32 5>, align 16
273 @llvm_mips_dpsub_u_d_ARG3 = global <4 x i32> <i32 6, i32 7, i32 8, i32 9>, align 16
274 @llvm_mips_dpsub_u_d_RES = global <2 x i64> <i64 0, i64 0>, align 16
276 define void @llvm_mips_dpsub_u_d_test() nounwind {
278 %0 = load <2 x i64>, <2 x i64>* @llvm_mips_dpsub_u_d_ARG1
279 %1 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_u_d_ARG2
280 %2 = load <4 x i32>, <4 x i32>* @llvm_mips_dpsub_u_d_ARG3
281 %3 = tail call <2 x i64> @llvm.mips.dpsub.u.d(<2 x i64> %0, <4 x i32> %1, <4 x i32> %2)
282 store <2 x i64> %3, <2 x i64>* @llvm_mips_dpsub_u_d_RES
286 declare <2 x i64> @llvm.mips.dpsub.u.d(<2 x i64>, <4 x i32>, <4 x i32>) nounwind
288 ; CHECK: llvm_mips_dpsub_u_d_test:
294 ; CHECK: .size llvm_mips_dpsub_u_d_test