1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin -mattr=+ssse3 -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,SSE,X86-SSE
3 ; RUN: llc < %s -mtriple=i386-apple-darwin -mattr=+avx -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,AVX,X86-AVX,AVX1,X86-AVX1
4 ; RUN: llc < %s -mtriple=i386-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86,AVX,X86-AVX,AVX512,X86-AVX512
5 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+ssse3 -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,SSE,X64-SSE
6 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,AVX,X64-AVX,AVX1,X64-AVX1
7 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512bw,+avx512dq,+avx512vl -show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64,AVX,X64-AVX,AVX512,X64-AVX512
9 define <16 x i8> @test_x86_ssse3_pabs_b_128(<16 x i8> %a0) {
10 ; SSE-LABEL: test_x86_ssse3_pabs_b_128:
12 ; SSE-NEXT: pabsb %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x38,0x1c,0xc0]
13 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
15 ; AVX1-LABEL: test_x86_ssse3_pabs_b_128:
17 ; AVX1-NEXT: vpabsb %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x1c,0xc0]
18 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
20 ; AVX512-LABEL: test_x86_ssse3_pabs_b_128:
22 ; AVX512-NEXT: vpabsb %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x1c,0xc0]
23 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
24 %res = call <16 x i8> @llvm.x86.ssse3.pabs.b.128(<16 x i8> %a0) ; <<16 x i8>> [#uses=1]
27 declare <16 x i8> @llvm.x86.ssse3.pabs.b.128(<16 x i8>) nounwind readnone
30 define <4 x i32> @test_x86_ssse3_pabs_d_128(<4 x i32> %a0) {
31 ; SSE-LABEL: test_x86_ssse3_pabs_d_128:
33 ; SSE-NEXT: pabsd %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x38,0x1e,0xc0]
34 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
36 ; AVX1-LABEL: test_x86_ssse3_pabs_d_128:
38 ; AVX1-NEXT: vpabsd %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x1e,0xc0]
39 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
41 ; AVX512-LABEL: test_x86_ssse3_pabs_d_128:
43 ; AVX512-NEXT: vpabsd %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x1e,0xc0]
44 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
45 %res = call <4 x i32> @llvm.x86.ssse3.pabs.d.128(<4 x i32> %a0) ; <<4 x i32>> [#uses=1]
48 declare <4 x i32> @llvm.x86.ssse3.pabs.d.128(<4 x i32>) nounwind readnone
51 define <8 x i16> @test_x86_ssse3_pabs_w_128(<8 x i16> %a0) {
52 ; SSE-LABEL: test_x86_ssse3_pabs_w_128:
54 ; SSE-NEXT: pabsw %xmm0, %xmm0 ## encoding: [0x66,0x0f,0x38,0x1d,0xc0]
55 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
57 ; AVX1-LABEL: test_x86_ssse3_pabs_w_128:
59 ; AVX1-NEXT: vpabsw %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x1d,0xc0]
60 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
62 ; AVX512-LABEL: test_x86_ssse3_pabs_w_128:
64 ; AVX512-NEXT: vpabsw %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x1d,0xc0]
65 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
66 %res = call <8 x i16> @llvm.x86.ssse3.pabs.w.128(<8 x i16> %a0) ; <<8 x i16>> [#uses=1]
69 declare <8 x i16> @llvm.x86.ssse3.pabs.w.128(<8 x i16>) nounwind readnone
72 define <4 x i32> @test_x86_ssse3_phadd_d_128(<4 x i32> %a0, <4 x i32> %a1) {
73 ; SSE-LABEL: test_x86_ssse3_phadd_d_128:
75 ; SSE-NEXT: phaddd %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x02,0xc1]
76 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
78 ; AVX-LABEL: test_x86_ssse3_phadd_d_128:
80 ; AVX-NEXT: vphaddd %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x02,0xc1]
81 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
82 %res = call <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
85 declare <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32>, <4 x i32>) nounwind readnone
88 define <8 x i16> @test_x86_ssse3_phadd_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
89 ; SSE-LABEL: test_x86_ssse3_phadd_sw_128:
91 ; SSE-NEXT: phaddsw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x03,0xc1]
92 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
94 ; AVX-LABEL: test_x86_ssse3_phadd_sw_128:
96 ; AVX-NEXT: vphaddsw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x03,0xc1]
97 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
98 %res = call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
101 declare <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
104 define <8 x i16> @test_x86_ssse3_phadd_w_128(<8 x i16> %a0, <8 x i16> %a1) {
105 ; SSE-LABEL: test_x86_ssse3_phadd_w_128:
107 ; SSE-NEXT: phaddw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x01,0xc1]
108 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
110 ; AVX-LABEL: test_x86_ssse3_phadd_w_128:
112 ; AVX-NEXT: vphaddw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x01,0xc1]
113 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
114 %res = call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
117 declare <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16>, <8 x i16>) nounwind readnone
120 define <4 x i32> @test_x86_ssse3_phsub_d_128(<4 x i32> %a0, <4 x i32> %a1) {
121 ; SSE-LABEL: test_x86_ssse3_phsub_d_128:
123 ; SSE-NEXT: phsubd %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x06,0xc1]
124 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
126 ; AVX-LABEL: test_x86_ssse3_phsub_d_128:
128 ; AVX-NEXT: vphsubd %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x06,0xc1]
129 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
130 %res = call <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
133 declare <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32>, <4 x i32>) nounwind readnone
136 define <8 x i16> @test_x86_ssse3_phsub_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
137 ; SSE-LABEL: test_x86_ssse3_phsub_sw_128:
139 ; SSE-NEXT: phsubsw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x07,0xc1]
140 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
142 ; AVX-LABEL: test_x86_ssse3_phsub_sw_128:
144 ; AVX-NEXT: vphsubsw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x07,0xc1]
145 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
146 %res = call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
149 declare <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
152 define <8 x i16> @test_x86_ssse3_phsub_w_128(<8 x i16> %a0, <8 x i16> %a1) {
153 ; SSE-LABEL: test_x86_ssse3_phsub_w_128:
155 ; SSE-NEXT: phsubw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x05,0xc1]
156 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
158 ; AVX-LABEL: test_x86_ssse3_phsub_w_128:
160 ; AVX-NEXT: vphsubw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x05,0xc1]
161 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
162 %res = call <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
165 declare <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16>, <8 x i16>) nounwind readnone
168 define <8 x i16> @test_x86_ssse3_pmadd_ub_sw_128(<16 x i8> %a0, <16 x i8> %a1) {
169 ; SSE-LABEL: test_x86_ssse3_pmadd_ub_sw_128:
171 ; SSE-NEXT: pmaddubsw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x04,0xc1]
172 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
174 ; AVX1-LABEL: test_x86_ssse3_pmadd_ub_sw_128:
176 ; AVX1-NEXT: vpmaddubsw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x04,0xc1]
177 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
179 ; AVX512-LABEL: test_x86_ssse3_pmadd_ub_sw_128:
181 ; AVX512-NEXT: vpmaddubsw %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x04,0xc1]
182 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
183 %res = call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %a0, <16 x i8> %a1) ; <<8 x i16>> [#uses=1]
186 declare <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8>, <16 x i8>) nounwind readnone
189 ; Make sure we don't commute this operation.
190 define <8 x i16> @test_x86_ssse3_pmadd_ub_sw_128_load_op0(<16 x i8>* %ptr, <16 x i8> %a1) {
191 ; X86-SSE-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
193 ; X86-SSE-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
194 ; X86-SSE-NEXT: movdqa (%eax), %xmm1 ## encoding: [0x66,0x0f,0x6f,0x08]
195 ; X86-SSE-NEXT: pmaddubsw %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x38,0x04,0xc8]
196 ; X86-SSE-NEXT: movdqa %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x6f,0xc1]
197 ; X86-SSE-NEXT: retl ## encoding: [0xc3]
199 ; X86-AVX1-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
200 ; X86-AVX1: ## %bb.0:
201 ; X86-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
202 ; X86-AVX1-NEXT: vmovdqa (%eax), %xmm1 ## encoding: [0xc5,0xf9,0x6f,0x08]
203 ; X86-AVX1-NEXT: vpmaddubsw %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe2,0x71,0x04,0xc0]
204 ; X86-AVX1-NEXT: retl ## encoding: [0xc3]
206 ; X86-AVX512-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
207 ; X86-AVX512: ## %bb.0:
208 ; X86-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x04]
209 ; X86-AVX512-NEXT: vmovdqa (%eax), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0x08]
210 ; X86-AVX512-NEXT: vpmaddubsw %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x71,0x04,0xc0]
211 ; X86-AVX512-NEXT: retl ## encoding: [0xc3]
213 ; X64-SSE-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
215 ; X64-SSE-NEXT: movdqa (%rdi), %xmm1 ## encoding: [0x66,0x0f,0x6f,0x0f]
216 ; X64-SSE-NEXT: pmaddubsw %xmm0, %xmm1 ## encoding: [0x66,0x0f,0x38,0x04,0xc8]
217 ; X64-SSE-NEXT: movdqa %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x6f,0xc1]
218 ; X64-SSE-NEXT: retq ## encoding: [0xc3]
220 ; X64-AVX1-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
221 ; X64-AVX1: ## %bb.0:
222 ; X64-AVX1-NEXT: vmovdqa (%rdi), %xmm1 ## encoding: [0xc5,0xf9,0x6f,0x0f]
223 ; X64-AVX1-NEXT: vpmaddubsw %xmm0, %xmm1, %xmm0 ## encoding: [0xc4,0xe2,0x71,0x04,0xc0]
224 ; X64-AVX1-NEXT: retq ## encoding: [0xc3]
226 ; X64-AVX512-LABEL: test_x86_ssse3_pmadd_ub_sw_128_load_op0:
227 ; X64-AVX512: ## %bb.0:
228 ; X64-AVX512-NEXT: vmovdqa (%rdi), %xmm1 ## EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0x0f]
229 ; X64-AVX512-NEXT: vpmaddubsw %xmm0, %xmm1, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x71,0x04,0xc0]
230 ; X64-AVX512-NEXT: retq ## encoding: [0xc3]
231 %a0 = load <16 x i8>, <16 x i8>* %ptr
232 %res = call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %a0, <16 x i8> %a1) ; <<8 x i16>> [#uses=1]
237 define <8 x i16> @test_x86_ssse3_pmul_hr_sw_128(<8 x i16> %a0, <8 x i16> %a1) {
238 ; SSE-LABEL: test_x86_ssse3_pmul_hr_sw_128:
240 ; SSE-NEXT: pmulhrsw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x0b,0xc1]
241 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
243 ; AVX1-LABEL: test_x86_ssse3_pmul_hr_sw_128:
245 ; AVX1-NEXT: vpmulhrsw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x0b,0xc1]
246 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
248 ; AVX512-LABEL: test_x86_ssse3_pmul_hr_sw_128:
250 ; AVX512-NEXT: vpmulhrsw %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x0b,0xc1]
251 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
252 %res = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
255 declare <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16>, <8 x i16>) nounwind readnone
258 define <16 x i8> @test_x86_ssse3_pshuf_b_128(<16 x i8> %a0, <16 x i8> %a1) {
259 ; SSE-LABEL: test_x86_ssse3_pshuf_b_128:
261 ; SSE-NEXT: pshufb %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x00,0xc1]
262 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
264 ; AVX1-LABEL: test_x86_ssse3_pshuf_b_128:
266 ; AVX1-NEXT: vpshufb %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x00,0xc1]
267 ; AVX1-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
269 ; AVX512-LABEL: test_x86_ssse3_pshuf_b_128:
271 ; AVX512-NEXT: vpshufb %xmm1, %xmm0, %xmm0 ## EVEX TO VEX Compression encoding: [0xc4,0xe2,0x79,0x00,0xc1]
272 ; AVX512-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
273 %res = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
276 declare <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8>, <16 x i8>) nounwind readnone
279 define <16 x i8> @test_x86_ssse3_psign_b_128(<16 x i8> %a0, <16 x i8> %a1) {
280 ; SSE-LABEL: test_x86_ssse3_psign_b_128:
282 ; SSE-NEXT: psignb %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x08,0xc1]
283 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
285 ; AVX-LABEL: test_x86_ssse3_psign_b_128:
287 ; AVX-NEXT: vpsignb %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x08,0xc1]
288 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
289 %res = call <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8> %a0, <16 x i8> %a1) ; <<16 x i8>> [#uses=1]
292 declare <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8>, <16 x i8>) nounwind readnone
295 define <4 x i32> @test_x86_ssse3_psign_d_128(<4 x i32> %a0, <4 x i32> %a1) {
296 ; SSE-LABEL: test_x86_ssse3_psign_d_128:
298 ; SSE-NEXT: psignd %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x0a,0xc1]
299 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
301 ; AVX-LABEL: test_x86_ssse3_psign_d_128:
303 ; AVX-NEXT: vpsignd %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x0a,0xc1]
304 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
305 %res = call <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32> %a0, <4 x i32> %a1) ; <<4 x i32>> [#uses=1]
308 declare <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32>, <4 x i32>) nounwind readnone
311 define <8 x i16> @test_x86_ssse3_psign_w_128(<8 x i16> %a0, <8 x i16> %a1) {
312 ; SSE-LABEL: test_x86_ssse3_psign_w_128:
314 ; SSE-NEXT: psignw %xmm1, %xmm0 ## encoding: [0x66,0x0f,0x38,0x09,0xc1]
315 ; SSE-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
317 ; AVX-LABEL: test_x86_ssse3_psign_w_128:
319 ; AVX-NEXT: vpsignw %xmm1, %xmm0, %xmm0 ## encoding: [0xc4,0xe2,0x79,0x09,0xc1]
320 ; AVX-NEXT: ret{{[l|q]}} ## encoding: [0xc3]
321 %res = call <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16> %a0, <8 x i16> %a1) ; <<8 x i16>> [#uses=1]
324 declare <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16>, <8 x i16>) nounwind readnone