1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=i686-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X64
5 define <16 x i8> @commute_fold_vpcomb(<16 x i8>* %a0, <16 x i8> %a1) {
6 ; X32-LABEL: commute_fold_vpcomb:
8 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; X32-NEXT: vpcomgtb (%eax), %xmm0, %xmm0
12 ; X64-LABEL: commute_fold_vpcomb:
14 ; X64-NEXT: vpcomgtb (%rdi), %xmm0, %xmm0
16 %1 = load <16 x i8>, <16 x i8>* %a0
17 %2 = call <16 x i8> @llvm.x86.xop.vpcomb(<16 x i8> %1, <16 x i8> %a1, i8 0) ; vpcomltb
20 declare <16 x i8> @llvm.x86.xop.vpcomb(<16 x i8>, <16 x i8>, i8) nounwind readnone
22 define <4 x i32> @commute_fold_vpcomd(<4 x i32>* %a0, <4 x i32> %a1) {
23 ; X32-LABEL: commute_fold_vpcomd:
25 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
26 ; X32-NEXT: vpcomged (%eax), %xmm0, %xmm0
29 ; X64-LABEL: commute_fold_vpcomd:
31 ; X64-NEXT: vpcomged (%rdi), %xmm0, %xmm0
33 %1 = load <4 x i32>, <4 x i32>* %a0
34 %2 = call <4 x i32> @llvm.x86.xop.vpcomd(<4 x i32> %1, <4 x i32> %a1, i8 1) ; vpcomled
37 declare <4 x i32> @llvm.x86.xop.vpcomd(<4 x i32>, <4 x i32>, i8) nounwind readnone
39 define <2 x i64> @commute_fold_vpcomq(<2 x i64>* %a0, <2 x i64> %a1) {
40 ; X32-LABEL: commute_fold_vpcomq:
42 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
43 ; X32-NEXT: vpcomltq (%eax), %xmm0, %xmm0
46 ; X64-LABEL: commute_fold_vpcomq:
48 ; X64-NEXT: vpcomltq (%rdi), %xmm0, %xmm0
50 %1 = load <2 x i64>, <2 x i64>* %a0
51 %2 = call <2 x i64> @llvm.x86.xop.vpcomq(<2 x i64> %1, <2 x i64> %a1, i8 2) ; vpcomgtq
54 declare <2 x i64> @llvm.x86.xop.vpcomq(<2 x i64>, <2 x i64>, i8) nounwind readnone
56 define <16 x i8> @commute_fold_vpcomub(<16 x i8>* %a0, <16 x i8> %a1) {
57 ; X32-LABEL: commute_fold_vpcomub:
59 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
60 ; X32-NEXT: vpcomleub (%eax), %xmm0, %xmm0
63 ; X64-LABEL: commute_fold_vpcomub:
65 ; X64-NEXT: vpcomleub (%rdi), %xmm0, %xmm0
67 %1 = load <16 x i8>, <16 x i8>* %a0
68 %2 = call <16 x i8> @llvm.x86.xop.vpcomub(<16 x i8> %1, <16 x i8> %a1, i8 3) ; vpcomgeub
71 declare <16 x i8> @llvm.x86.xop.vpcomub(<16 x i8>, <16 x i8>, i8) nounwind readnone
73 define <4 x i32> @commute_fold_vpcomud(<4 x i32>* %a0, <4 x i32> %a1) {
74 ; X32-LABEL: commute_fold_vpcomud:
76 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
77 ; X32-NEXT: vpcomeqd (%eax), %xmm0, %xmm0
80 ; X64-LABEL: commute_fold_vpcomud:
82 ; X64-NEXT: vpcomeqd (%rdi), %xmm0, %xmm0
84 %1 = load <4 x i32>, <4 x i32>* %a0
85 %2 = call <4 x i32> @llvm.x86.xop.vpcomud(<4 x i32> %1, <4 x i32> %a1, i8 4) ; vpcomequd
88 declare <4 x i32> @llvm.x86.xop.vpcomud(<4 x i32>, <4 x i32>, i8) nounwind readnone
90 define <2 x i64> @commute_fold_vpcomuq(<2 x i64>* %a0, <2 x i64> %a1) {
91 ; X32-LABEL: commute_fold_vpcomuq:
93 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
94 ; X32-NEXT: vpcomneqq (%eax), %xmm0, %xmm0
97 ; X64-LABEL: commute_fold_vpcomuq:
99 ; X64-NEXT: vpcomneqq (%rdi), %xmm0, %xmm0
101 %1 = load <2 x i64>, <2 x i64>* %a0
102 %2 = call <2 x i64> @llvm.x86.xop.vpcomuq(<2 x i64> %1, <2 x i64> %a1, i8 5) ; vpcomnequq
105 declare <2 x i64> @llvm.x86.xop.vpcomuq(<2 x i64>, <2 x i64>, i8) nounwind readnone
107 define <8 x i16> @commute_fold_vpcomuw(<8 x i16>* %a0, <8 x i16> %a1) {
108 ; X32-LABEL: commute_fold_vpcomuw:
110 ; X32-NEXT: vxorps %xmm0, %xmm0, %xmm0
113 ; X64-LABEL: commute_fold_vpcomuw:
115 ; X64-NEXT: vxorps %xmm0, %xmm0, %xmm0
117 %1 = load <8 x i16>, <8 x i16>* %a0
118 %2 = call <8 x i16> @llvm.x86.xop.vpcomuw(<8 x i16> %1, <8 x i16> %a1, i8 6) ; vpcomfalseuw
121 declare <8 x i16> @llvm.x86.xop.vpcomuw(<8 x i16>, <8 x i16>, i8) nounwind readnone
123 define <8 x i16> @commute_fold_vpcomw(<8 x i16>* %a0, <8 x i16> %a1) {
124 ; X32-LABEL: commute_fold_vpcomw:
126 ; X32-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
129 ; X64-LABEL: commute_fold_vpcomw:
131 ; X64-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
133 %1 = load <8 x i16>, <8 x i16>* %a0
134 %2 = call <8 x i16> @llvm.x86.xop.vpcomw(<8 x i16> %1, <8 x i16> %a1, i8 7) ; vpcomtruew
137 declare <8 x i16> @llvm.x86.xop.vpcomw(<8 x i16>, <8 x i16>, i8) nounwind readnone
139 define <4 x i32> @commute_fold_vpmacsdd(<4 x i32>* %a0, <4 x i32> %a1, <4 x i32> %a2) {
140 ; X32-LABEL: commute_fold_vpmacsdd:
142 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
143 ; X32-NEXT: vpmacsdd %xmm1, (%eax), %xmm0, %xmm0
146 ; X64-LABEL: commute_fold_vpmacsdd:
148 ; X64-NEXT: vpmacsdd %xmm1, (%rdi), %xmm0, %xmm0
150 %1 = load <4 x i32>, <4 x i32>* %a0
151 %2 = call <4 x i32> @llvm.x86.xop.vpmacsdd(<4 x i32> %1, <4 x i32> %a1, <4 x i32> %a2)
154 declare <4 x i32> @llvm.x86.xop.vpmacsdd(<4 x i32>, <4 x i32>, <4 x i32>) nounwind readnone
156 define <2 x i64> @commute_fold_vpmacsdqh(<4 x i32>* %a0, <4 x i32> %a1, <2 x i64> %a2) {
157 ; X32-LABEL: commute_fold_vpmacsdqh:
159 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
160 ; X32-NEXT: vpmacsdqh %xmm1, (%eax), %xmm0, %xmm0
163 ; X64-LABEL: commute_fold_vpmacsdqh:
165 ; X64-NEXT: vpmacsdqh %xmm1, (%rdi), %xmm0, %xmm0
167 %1 = load <4 x i32>, <4 x i32>* %a0
168 %2 = call <2 x i64> @llvm.x86.xop.vpmacsdqh(<4 x i32> %1, <4 x i32> %a1, <2 x i64> %a2)
171 declare <2 x i64> @llvm.x86.xop.vpmacsdqh(<4 x i32>, <4 x i32>, <2 x i64>) nounwind readnone
173 define <2 x i64> @commute_fold_vpmacsdql(<4 x i32>* %a0, <4 x i32> %a1, <2 x i64> %a2) {
174 ; X32-LABEL: commute_fold_vpmacsdql:
176 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
177 ; X32-NEXT: vpmacsdql %xmm1, (%eax), %xmm0, %xmm0
180 ; X64-LABEL: commute_fold_vpmacsdql:
182 ; X64-NEXT: vpmacsdql %xmm1, (%rdi), %xmm0, %xmm0
184 %1 = load <4 x i32>, <4 x i32>* %a0
185 %2 = call <2 x i64> @llvm.x86.xop.vpmacsdql(<4 x i32> %1, <4 x i32> %a1, <2 x i64> %a2)
188 declare <2 x i64> @llvm.x86.xop.vpmacsdql(<4 x i32>, <4 x i32>, <2 x i64>) nounwind readnone
190 define <4 x i32> @commute_fold_vpmacssdd(<4 x i32>* %a0, <4 x i32> %a1, <4 x i32> %a2) {
191 ; X32-LABEL: commute_fold_vpmacssdd:
193 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
194 ; X32-NEXT: vpmacssdd %xmm1, (%eax), %xmm0, %xmm0
197 ; X64-LABEL: commute_fold_vpmacssdd:
199 ; X64-NEXT: vpmacssdd %xmm1, (%rdi), %xmm0, %xmm0
201 %1 = load <4 x i32>, <4 x i32>* %a0
202 %2 = call <4 x i32> @llvm.x86.xop.vpmacssdd(<4 x i32> %1, <4 x i32> %a1, <4 x i32> %a2)
205 declare <4 x i32> @llvm.x86.xop.vpmacssdd(<4 x i32>, <4 x i32>, <4 x i32>) nounwind readnone
207 define <2 x i64> @commute_fold_vpmacssdqh(<4 x i32>* %a0, <4 x i32> %a1, <2 x i64> %a2) {
208 ; X32-LABEL: commute_fold_vpmacssdqh:
210 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
211 ; X32-NEXT: vpmacssdqh %xmm1, (%eax), %xmm0, %xmm0
214 ; X64-LABEL: commute_fold_vpmacssdqh:
216 ; X64-NEXT: vpmacssdqh %xmm1, (%rdi), %xmm0, %xmm0
218 %1 = load <4 x i32>, <4 x i32>* %a0
219 %2 = call <2 x i64> @llvm.x86.xop.vpmacssdqh(<4 x i32> %1, <4 x i32> %a1, <2 x i64> %a2)
222 declare <2 x i64> @llvm.x86.xop.vpmacssdqh(<4 x i32>, <4 x i32>, <2 x i64>) nounwind readnone
224 define <2 x i64> @commute_fold_vpmacssdql(<4 x i32>* %a0, <4 x i32> %a1, <2 x i64> %a2) {
225 ; X32-LABEL: commute_fold_vpmacssdql:
227 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
228 ; X32-NEXT: vpmacssdql %xmm1, (%eax), %xmm0, %xmm0
231 ; X64-LABEL: commute_fold_vpmacssdql:
233 ; X64-NEXT: vpmacssdql %xmm1, (%rdi), %xmm0, %xmm0
235 %1 = load <4 x i32>, <4 x i32>* %a0
236 %2 = call <2 x i64> @llvm.x86.xop.vpmacssdql(<4 x i32> %1, <4 x i32> %a1, <2 x i64> %a2)
239 declare <2 x i64> @llvm.x86.xop.vpmacssdql(<4 x i32>, <4 x i32>, <2 x i64>) nounwind readnone
241 define <4 x i32> @commute_fold_vpmacsswd(<8 x i16>* %a0, <8 x i16> %a1, <4 x i32> %a2) {
242 ; X32-LABEL: commute_fold_vpmacsswd:
244 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
245 ; X32-NEXT: vpmacsswd %xmm1, (%eax), %xmm0, %xmm0
248 ; X64-LABEL: commute_fold_vpmacsswd:
250 ; X64-NEXT: vpmacsswd %xmm1, (%rdi), %xmm0, %xmm0
252 %1 = load <8 x i16>, <8 x i16>* %a0
253 %2 = call <4 x i32> @llvm.x86.xop.vpmacsswd(<8 x i16> %1, <8 x i16> %a1, <4 x i32> %a2)
256 declare <4 x i32> @llvm.x86.xop.vpmacsswd(<8 x i16>, <8 x i16>, <4 x i32>) nounwind readnone
258 define <8 x i16> @commute_fold_vpmacssww(<8 x i16>* %a0, <8 x i16> %a1, <8 x i16> %a2) {
259 ; X32-LABEL: commute_fold_vpmacssww:
261 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
262 ; X32-NEXT: vpmacssww %xmm1, (%eax), %xmm0, %xmm0
265 ; X64-LABEL: commute_fold_vpmacssww:
267 ; X64-NEXT: vpmacssww %xmm1, (%rdi), %xmm0, %xmm0
269 %1 = load <8 x i16>, <8 x i16>* %a0
270 %2 = call <8 x i16> @llvm.x86.xop.vpmacssww(<8 x i16> %1, <8 x i16> %a1, <8 x i16> %a2)
273 declare <8 x i16> @llvm.x86.xop.vpmacssww(<8 x i16>, <8 x i16>, <8 x i16>) nounwind readnone
275 define <4 x i32> @commute_fold_vpmacswd(<8 x i16>* %a0, <8 x i16> %a1, <4 x i32> %a2) {
276 ; X32-LABEL: commute_fold_vpmacswd:
278 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
279 ; X32-NEXT: vpmacswd %xmm1, (%eax), %xmm0, %xmm0
282 ; X64-LABEL: commute_fold_vpmacswd:
284 ; X64-NEXT: vpmacswd %xmm1, (%rdi), %xmm0, %xmm0
286 %1 = load <8 x i16>, <8 x i16>* %a0
287 %2 = call <4 x i32> @llvm.x86.xop.vpmacswd(<8 x i16> %1, <8 x i16> %a1, <4 x i32> %a2)
290 declare <4 x i32> @llvm.x86.xop.vpmacswd(<8 x i16>, <8 x i16>, <4 x i32>) nounwind readnone
292 define <8 x i16> @commute_fold_vpmacsww(<8 x i16>* %a0, <8 x i16> %a1, <8 x i16> %a2) {
293 ; X32-LABEL: commute_fold_vpmacsww:
295 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
296 ; X32-NEXT: vpmacsww %xmm1, (%eax), %xmm0, %xmm0
299 ; X64-LABEL: commute_fold_vpmacsww:
301 ; X64-NEXT: vpmacsww %xmm1, (%rdi), %xmm0, %xmm0
303 %1 = load <8 x i16>, <8 x i16>* %a0
304 %2 = call <8 x i16> @llvm.x86.xop.vpmacsww(<8 x i16> %1, <8 x i16> %a1, <8 x i16> %a2)
307 declare <8 x i16> @llvm.x86.xop.vpmacsww(<8 x i16>, <8 x i16>, <8 x i16>) nounwind readnone
309 define <4 x i32> @commute_fold_vpmadcsswd(<8 x i16>* %a0, <8 x i16> %a1, <4 x i32> %a2) {
310 ; X32-LABEL: commute_fold_vpmadcsswd:
312 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
313 ; X32-NEXT: vpmadcsswd %xmm1, (%eax), %xmm0, %xmm0
316 ; X64-LABEL: commute_fold_vpmadcsswd:
318 ; X64-NEXT: vpmadcsswd %xmm1, (%rdi), %xmm0, %xmm0
320 %1 = load <8 x i16>, <8 x i16>* %a0
321 %2 = call <4 x i32> @llvm.x86.xop.vpmadcsswd(<8 x i16> %1, <8 x i16> %a1, <4 x i32> %a2)
324 declare <4 x i32> @llvm.x86.xop.vpmadcsswd(<8 x i16>, <8 x i16>, <4 x i32>) nounwind readnone
326 define <4 x i32> @commute_fold_vpmadcswd(<8 x i16>* %a0, <8 x i16> %a1, <4 x i32> %a2) {
327 ; X32-LABEL: commute_fold_vpmadcswd:
329 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
330 ; X32-NEXT: vpmadcswd %xmm1, (%eax), %xmm0, %xmm0
333 ; X64-LABEL: commute_fold_vpmadcswd:
335 ; X64-NEXT: vpmadcswd %xmm1, (%rdi), %xmm0, %xmm0
337 %1 = load <8 x i16>, <8 x i16>* %a0
338 %2 = call <4 x i32> @llvm.x86.xop.vpmadcswd(<8 x i16> %1, <8 x i16> %a1, <4 x i32> %a2)
341 declare <4 x i32> @llvm.x86.xop.vpmadcswd(<8 x i16>, <8 x i16>, <4 x i32>) nounwind readnone