1 ; RUN: llc -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s -mtriple=ppc64le-- -mcpu=pwr8 | FileCheck %s --check-prefixes=CHECK,CHECK-P8
2 ; RUN: llc -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s -mtriple=ppc64le-- -mcpu=pwr9 | FileCheck %s --check-prefixes=CHECK,CHECK-P9
4 define <16 x i8> @test1_v16i8(<16 x i8> %a) {
5 %tmp.1 = mul nsw <16 x i8> %a, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16> ; <<16 x i8>> [#uses=1]
8 ; CHECK-LABEL: test1_v16i8:
9 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
10 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
12 ; CHECK-NEXT: vslb v[[REG2:[0-9]+]], v2, v[[REG1]]
14 define <16 x i8> @test2_v16i8(<16 x i8> %a) {
15 %tmp.1 = mul nsw <16 x i8> %a, <i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17, i8 17> ; <<16 x i8>> [#uses=1]
18 ; CHECK-LABEL: test2_v16i8:
19 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
20 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
22 ; CHECK-NEXT: vslb v[[REG2:[0-9]+]], v2, v[[REG1]]
23 ; CHECK-NEXT: vaddubm v[[REG3:[0-9]+]], v2, v[[REG2]]
25 define <16 x i8> @test3_v16i8(<16 x i8> %a) {
26 %tmp.1 = mul nsw <16 x i8> %a, <i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15, i8 15> ; <<16 x i8>> [#uses=1]
29 ; CHECK-LABEL: test3_v16i8:
30 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
31 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
33 ; CHECK-NEXT: vslb v[[REG2:[0-9]+]], v2, v[[REG1]]
34 ; CHECK-NEXT: vsububm v[[REG3:[0-9]+]], v[[REG2]], v2
38 define <16 x i8> @test4_v16i8(<16 x i8> %a) {
39 %tmp.1 = mul nsw <16 x i8> %a, <i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16, i8 -16> ; <<16 x i8>> [#uses=1]
42 ; CHECK-LABEL: test4_v16i8:
43 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
44 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
46 ; CHECK-NEXT: vslb v[[REG3:[0-9]+]], v2, v[[REG1]]
47 ; CHECK-NEXT: xxlxor v[[REG2:[0-9]+]],
48 ; CHECK-NEXT: vsububm v[[REG4:[0-9]+]], v[[REG2]], v[[REG3]]
50 define <16 x i8> @test5_v16i8(<16 x i8> %a) {
51 %tmp.1 = mul nsw <16 x i8> %a, <i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17, i8 -17> ; <<16 x i8>> [#uses=1]
54 ; CHECK-LABEL: test5_v16i8:
55 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
56 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
58 ; CHECK-NEXT: vslb v[[REG3:[0-9]+]], v2, v[[REG1]]
59 ; CHECK-NEXT: vaddubm v[[REG4:[0-9]+]], v2, v[[REG3]]
60 ; CHECK-NEXT: xxlxor v[[REG2:[0-9]+]],
61 ; CHECK-NEXT: vsububm v[[REG5:[0-9]+]], v[[REG2]], v[[REG4]]
63 define <16 x i8> @test6_v16i8(<16 x i8> %a) {
64 %tmp.1 = mul nsw <16 x i8> %a, <i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15, i8 -15> ; <<16 x i8>> [#uses=1]
67 ; CHECK-LABEL: test6_v16i8:
68 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 4
69 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 4
71 ; CHECK-NEXT: vslb v[[REG2:[0-9]+]], v2, v[[REG1]]
72 ; CHECK-NEXT: vsububm v[[REG3:[0-9]+]], v2, v[[REG2]]
76 define <16 x i8> @test7_v16i8(<16 x i8> %a) {
77 %tmp.1 = mul nsw <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128> ; <<16 x i8>> [#uses=1]
80 ; CHECK-LABEL: test7_v16i8:
81 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 7
82 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 7
84 ; CHECK-NEXT: vslb v[[REG5:[0-9]+]], v2, v[[REG1]]
86 define <16 x i8> @test8_v16i8(<16 x i8> %a) {
87 %tmp.1 = mul nsw <16 x i8> %a, <i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127, i8 127> ; <<16 x i8>> [#uses=1]
90 ; CHECK-LABEL: test8_v16i8:
91 ; CHECK-P8: vspltisb v[[REG1:[0-9]+]], 7
92 ; CHECK-P9: xxspltib v[[REG1:[0-9]+]], 7
94 ; CHECK-NEXT: vslb v[[REG2:[0-9]+]], v2, v[[REG1]]
95 ; CHECK-NEXT: vsububm v[[REG3:[0-9]+]], v[[REG2]], v2
97 define <8 x i16> @test1_v8i16(<8 x i16> %a) {
98 %tmp.1 = mul nsw <8 x i16> %a, <i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16> ; <<8 x i16>> [#uses=1]
101 ; CHECK-LABEL: test1_v8i16:
102 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
104 ; CHECK-NEXT: vslh v[[REG2:[0-9]+]], v2, v[[REG1]]
106 define <8 x i16> @test2_v8i16(<8 x i16> %a) {
107 %tmp.1 = mul nsw <8 x i16> %a, <i16 17, i16 17, i16 17, i16 17, i16 17, i16 17, i16 17, i16 17> ; <<8 x i16>> [#uses=1]
110 ; CHECK-LABEL: test2_v8i16:
111 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
113 ; CHECK-NEXT: vslh v[[REG2:[0-9]+]], v2, v[[REG1]]
114 ; CHECK-NEXT: vadduhm v[[REG3:[0-9]+]], v2, v[[REG2]]
116 define <8 x i16> @test3_v8i16(<8 x i16> %a) {
117 %tmp.1 = mul nsw <8 x i16> %a, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15> ; <<8 x i16>> [#uses=1]
120 ; CHECK-LABEL: test3_v8i16:
121 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
123 ; CHECK-NEXT: vslh v[[REG2:[0-9]+]], v2, v[[REG1]]
124 ; CHECK-NEXT: vsubuhm v[[REG3:[0-9]+]], v[[REG2]], v2
128 define <8 x i16> @test4_v8i16(<8 x i16> %a) {
129 %tmp.1 = mul nsw <8 x i16> %a, <i16 -16, i16 -16, i16 -16, i16 -16, i16 -16, i16 -16, i16 -16, i16 -16> ; <<8 x i16>> [#uses=1]
132 ; CHECK-LABEL: test4_v8i16:
133 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
135 ; CHECK-NEXT: vslh v[[REG3:[0-9]+]], v2, v[[REG1]]
136 ; CHECK-NEXT: xxlxor v[[REG2:[0-9]+]],
137 ; CHECK-NEXT: vsubuhm v[[REG4:[0-9]+]], v[[REG2]], v[[REG3]]
139 define <8 x i16> @test5_v8i16(<8 x i16> %a) {
140 %tmp.1 = mul nsw <8 x i16> %a, <i16 -17, i16 -17, i16 -17, i16 -17, i16 -17, i16 -17, i16 -17, i16 -17> ; <<8 x i16>> [#uses=1]
143 ; CHECK-LABEL: test5_v8i16:
144 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
146 ; CHECK-NEXT: vslh v[[REG3:[0-9]+]], v2, v[[REG1]]
147 ; CHECK-NEXT: vadduhm v[[REG4:[0-9]+]], v2, v[[REG3]]
148 ; CHECK-NEXT: xxlxor v[[REG2:[0-9]+]],
149 ; CHECK-NEXT: vsubuhm v[[REG5:[0-9]+]], v[[REG2]], v[[REG4]]
151 define <8 x i16> @test6_v8i16(<8 x i16> %a) {
152 %tmp.1 = mul nsw <8 x i16> %a, <i16 -15, i16 -15, i16 -15, i16 -15, i16 -15, i16 -15, i16 -15, i16 -15> ; <<8 x i16>> [#uses=1]
155 ; CHECK-LABEL: test6_v8i16:
156 ; CHECK: vspltish v[[REG1:[0-9]+]], 4
158 ; CHECK-NEXT: vslh v[[REG2:[0-9]+]], v2, v[[REG1]]
159 ; CHECK-NEXT: vsubuhm v[[REG3:[0-9]+]], v2, v[[REG2]]
163 define <8 x i16> @test7_v8i16(<8 x i16> %a) {
164 %tmp.1 = mul nsw <8 x i16> %a, <i16 -32768, i16 -32768, i16 -32768, i16 -32768, i16 -32768, i16 -32768, i16 -32768, i16 -32768> ; <<8 x i16>> [#uses=1]
167 ; CHECK-LABEL: test7_v8i16:
168 ; CHECK: vspltish v[[REG1:[0-9]+]], 15
170 ; CHECK-NEXT: vslh v[[REG5:[0-9]+]], v2, v[[REG1]]
172 define <8 x i16> @test8_v8i16(<8 x i16> %a) {
173 %tmp.1 = mul nsw <8 x i16> %a, <i16 32767, i16 32767, i16 32767, i16 32767, i16 32767, i16 32767, i16 32767, i16 32767> ; <<8 x i16>> [#uses=1]
176 ; CHECK-LABEL: test8_v8i16:
177 ; CHECK: vspltish v[[REG1:[0-9]+]], 15
179 ; CHECK-NEXT: vslh v[[REG2:[0-9]+]], v2, v[[REG1]]
180 ; CHECK-NEXT: vsubuhm v[[REG3:[0-9]+]], v[[REG2]], v2
182 define <4 x i32> @test1_v4i32(<4 x i32> %a) {
183 %tmp.1 = mul nsw <4 x i32> %a, <i32 16, i32 16, i32 16, i32 16> ; <<4 x i32>> [#uses=1]
186 ; CHECK-LABEL: test1_v4i32:
187 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
189 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
191 define <4 x i32> @test2_v4i32(<4 x i32> %a) {
192 %tmp.1 = mul nsw <4 x i32> %a, <i32 17, i32 17, i32 17, i32 17> ; <<4 x i32>> [#uses=1]
195 ; CHECK-LABEL: test2_v4i32:
196 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
198 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
199 ; CHECK-NEXT: vadduwm v[[REG3:[0-9]+]], v2, v[[REG2]]
201 define <4 x i32> @test3_v4i32(<4 x i32> %a) {
202 %tmp.1 = mul nsw <4 x i32> %a, <i32 15, i32 15, i32 15, i32 15> ; <<4 x i32>> [#uses=1]
205 ; CHECK-LABEL: test3_v4i32:
206 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
208 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
209 ; CHECK-NEXT: vsubuwm v[[REG3:[0-9]+]], v[[REG2]], v2
213 define <4 x i32> @test4_v4i32(<4 x i32> %a) {
214 %tmp.1 = mul nsw <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16> ; <<4 x i32>> [#uses=1]
217 ; CHECK-LABEL: test4_v4i32:
218 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
220 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
221 ; CHECK-P8-NEXT: xxlxor v[[REG3:[0-9]+]],
222 ; CHECK-P8-NEXT: vsubuwm v{{[0-9]+}}, v[[REG3]], v[[REG2]]
223 ; CHECK-P9-NEXT: vnegw v{{[0-9]+}}, v[[REG2]]
225 define <4 x i32> @test5_v4i32(<4 x i32> %a) {
226 %tmp.1 = mul nsw <4 x i32> %a, <i32 -17, i32 -17, i32 -17, i32 -17> ; <<4 x i32>> [#uses=1]
229 ; CHECK-LABEL: test5_v4i32:
230 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
232 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
233 ; CHECK-NEXT: vadduwm v[[REG3:[0-9]+]], v2, v[[REG2]]
234 ; CHECK-P8-NEXT: xxlxor v[[REG4:[0-9]+]],
235 ; CHECK-P8-NEXT: vsubuwm v{{[0-9]+}}, v[[REG4]], v[[REG3]]
236 ; CHECK-P9-NEXT: vnegw v{{[0-9]+}}, v[[REG3]]
238 define <4 x i32> @test6_v4i32(<4 x i32> %a) {
239 %tmp.1 = mul nsw <4 x i32> %a, <i32 -15, i32 -15, i32 -15, i32 -15> ; <<4 x i32>> [#uses=1]
242 ; CHECK-LABEL: test6_v4i32:
243 ; CHECK: vspltisw v[[REG1:[0-9]+]], 4
245 ; CHECK-NEXT: vslw v[[REG2:[0-9]+]], v2, v[[REG1]]
246 ; CHECK-NEXT: vsubuwm v[[REG3:[0-9]+]], v2, v[[REG2]]
250 define <4 x i32> @test7_v4i32(<4 x i32> %a) {
251 %tmp.1 = mul nsw <4 x i32> %a, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648> ; <<4 x i32>> [#uses=1]
254 ; CHECK-LABEL: test7_v4i32:
255 ; CHECK-DAG: vspltisw v[[REG2:[0-9]+]], -16
256 ; CHECK-DAG: vspltisw v[[REG3:[0-9]+]], 15
257 ; CHECK-NEXT: vsubuwm v[[REG4:[0-9]+]], v[[REG3]], v[[REG2]]
259 ; CHECK-NEXT: vslw v[[REG5:[0-9]+]], v2, v[[REG4]]
261 define <4 x i32> @test8_v4i32(<4 x i32> %a) {
262 %tmp.1 = mul nsw <4 x i32> %a, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647> ; <<4 x i32>> [#uses=1]
265 ; CHECK-LABEL: test8_v4i32:
266 ; CHECK-DAG: vspltisw v[[REG2:[0-9]+]], -16
267 ; CHECK-DAG: vspltisw v[[REG3:[0-9]+]], 15
268 ; CHECK-NEXT: vsubuwm v[[REG4:[0-9]+]], v[[REG3]], v[[REG2]]
270 ; CHECK-NEXT: vslw v[[REG5:[0-9]+]], v2, v[[REG4]]
271 ; CHECK-NEXT: vsubuwm v[[REG6:[0-9]+]], v[[REG5]], v2
273 define <2 x i64> @test1_v2i64(<2 x i64> %a) {
274 %tmp.1 = mul nsw <2 x i64> %a, <i64 16, i64 16> ; <<2 x i64>> [#uses=1]
277 ; CHECK-LABEL: test1_v2i64:
278 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
279 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
281 ; CHECK-NEXT: vsld v{{[0-9]+}}, v2, v[[REG2]]
283 define <2 x i64> @test2_v2i64(<2 x i64> %a) {
284 %tmp.1 = mul nsw <2 x i64> %a, <i64 17, i64 17> ; <<2 x i64>> [#uses=1]
288 ; CHECK-LABEL: test2_v2i64:
289 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
290 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
292 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
293 ; CHECK-NEXT: vaddudm v{{[0-9]+}}, v2, v[[REG3]]
295 define <2 x i64> @test3_v2i64(<2 x i64> %a) {
296 %tmp.1 = mul nsw <2 x i64> %a, <i64 15, i64 15> ; <<2 x i64>> [#uses=1]
300 ; CHECK-LABEL: test3_v2i64:
301 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
302 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
304 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
305 ; CHECK-NEXT: vsubudm v{{[0-9]+}}, v[[REG3]], v2
309 define <2 x i64> @test4_v2i64(<2 x i64> %a) {
310 %tmp.1 = mul nsw <2 x i64> %a, <i64 -16, i64 -16> ; <<2 x i64>> [#uses=1]
314 ; CHECK-LABEL: test4_v2i64:
315 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
316 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
318 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
319 ; CHECK-P8-NEXT: xxlxor v[[REG4:[0-9]+]],
320 ; CHECK-P8-NEXT: vsubudm v{{[0-9]+}}, v[[REG4]], v[[REG3]]
321 ; CHECK-P9-NEXT: vnegd v[[REG4:[0-9]+]], v[[REG3]]
323 define <2 x i64> @test5_v2i64(<2 x i64> %a) {
324 %tmp.1 = mul nsw <2 x i64> %a, <i64 -17, i64 -17> ; <<2 x i64>> [#uses=1]
328 ; CHECK-LABEL: test5_v2i64:
329 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
330 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
332 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
333 ; CHECK-NEXT: vaddudm v[[REG4:[0-9]+]], v2, v[[REG3]]
334 ; CHECK-P8-NEXT: xxlxor v[[REG5:[0-9]+]],
335 ; CHECK-P8-NEXT: vsubudm v[[REG6:[0-9]+]], v[[REG5]], v[[REG4]]
336 ; CHECK-P9-NEXT: vnegd v{{[0-9]+}}, v[[REG4]]
338 define <2 x i64> @test6_v2i64(<2 x i64> %a) {
339 %tmp.1 = mul nsw <2 x i64> %a, <i64 -15, i64 -15> ; <<2 x i64>> [#uses=1]
343 ; CHECK-LABEL: test6_v2i64:
344 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
345 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
347 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
348 ; CHECK-NEXT: vsubudm v{{[0-9]+}}, v2, v[[REG3]]
353 define <2 x i64> @test7_v2i64(<2 x i64> %a) {
354 %tmp.1 = mul nsw <2 x i64> %a, <i64 -9223372036854775808, i64 -9223372036854775808> ; <<2 x i64>> [#uses=1]
358 ; CHECK-LABEL: test7_v2i64:
359 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
360 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
362 ; CHECK-NEXT: vsld v[[REG4:[0-9]+]], v2, v[[REG2]]
364 define <2 x i64> @test8_v2i64(<2 x i64> %a) {
365 %tmp.1 = mul nsw <2 x i64> %a, <i64 9223372036854775807, i64 9223372036854775807> ; <<2 x i64>> [#uses=1]
369 ; CHECK-LABEL: test8_v2i64:
370 ; CHECK-P8: lxvd2x v[[REG1:[0-9]+]], 0, r{{[0-9]+}}
371 ; CHECK-P9: lxv v[[REG2:[0-9]+]], 0(r{{[0-9]+}})
373 ; CHECK-NEXT: vsld v[[REG3:[0-9]+]], v2, v[[REG2]]
374 ; CHECK-NEXT: vsubudm v{{[0-9]+}}, v[[REG3]], v2