; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse3 | FileCheck %s --check-prefixes=SSE,SSE3
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE,SSSE3
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop | FileCheck %s --check-prefixes=AVX,AVXNOVLBW,XOP
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw,+avx512vl,+avx512vbmi | FileCheck %s --check-prefixes=AVX,AVX512VL,VLVBMI
define <2 x i64> @var_shuffle_v2i64(<2 x i64> %v, <2 x i64> %indices) nounwind {
+; SSE3-LABEL: var_shuffle_v2i64:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movq %xmm1, %rax
+; SSE3-NEXT: andl $1, %eax
+; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
+; SSE3-NEXT: movq %xmm1, %rcx
+; SSE3-NEXT: andl $1, %ecx
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE3-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
+; SSE3-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
+; SSE3-NEXT: retq
+;
; SSSE3-LABEL: var_shuffle_v2i64:
; SSSE3: # %bb.0:
; SSSE3-NEXT: movq %xmm1, %rax
}
define <4 x i32> @var_shuffle_v4i32(<4 x i32> %v, <4 x i32> %indices) nounwind {
+; SSE3-LABEL: var_shuffle_v4i32:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movd %xmm1, %eax
+; SSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,2,3]
+; SSE3-NEXT: movd %xmm2, %ecx
+; SSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,0,1]
+; SSE3-NEXT: movd %xmm2, %edx
+; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[3,1,2,3]
+; SSE3-NEXT: movd %xmm1, %esi
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: andl $3, %eax
+; SSE3-NEXT: andl $3, %ecx
+; SSE3-NEXT: andl $3, %edx
+; SSE3-NEXT: andl $3, %esi
+; SSE3-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE3-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; SSE3-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
+; SSE3-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE3-NEXT: movss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; SSE3-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
+; SSE3-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
+; SSE3-NEXT: retq
+;
; SSSE3-LABEL: var_shuffle_v4i32:
; SSSE3: # %bb.0:
; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [67372036,67372036,67372036,67372036]
}
define <8 x i16> @var_shuffle_v8i16(<8 x i16> %v, <8 x i16> %indices) nounwind {
-; SSE-LABEL: var_shuffle_v8i16:
-; SSE: # %bb.0:
-; SSE-NEXT: pmullw {{.*}}(%rip), %xmm1
-; SSE-NEXT: paddw {{.*}}(%rip), %xmm1
-; SSE-NEXT: pshufb %xmm1, %xmm0
-; SSE-NEXT: retq
+; SSE3-LABEL: var_shuffle_v8i16:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movd %xmm1, %r8d
+; SSE3-NEXT: pextrw $1, %xmm1, %r9d
+; SSE3-NEXT: pextrw $2, %xmm1, %r10d
+; SSE3-NEXT: pextrw $3, %xmm1, %esi
+; SSE3-NEXT: pextrw $4, %xmm1, %edi
+; SSE3-NEXT: pextrw $5, %xmm1, %eax
+; SSE3-NEXT: pextrw $6, %xmm1, %ecx
+; SSE3-NEXT: pextrw $7, %xmm1, %edx
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: andl $7, %r8d
+; SSE3-NEXT: andl $7, %r9d
+; SSE3-NEXT: andl $7, %r10d
+; SSE3-NEXT: andl $7, %esi
+; SSE3-NEXT: andl $7, %edi
+; SSE3-NEXT: andl $7, %eax
+; SSE3-NEXT: andl $7, %ecx
+; SSE3-NEXT: andl $7, %edx
+; SSE3-NEXT: movzwl -24(%rsp,%rdx,2), %edx
+; SSE3-NEXT: movd %edx, %xmm0
+; SSE3-NEXT: movzwl -24(%rsp,%rcx,2), %ecx
+; SSE3-NEXT: movd %ecx, %xmm1
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
+; SSE3-NEXT: movzwl -24(%rsp,%rax,2), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: movzwl -24(%rsp,%rdi,2), %eax
+; SSE3-NEXT: movd %eax, %xmm2
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; SSE3-NEXT: movzwl -24(%rsp,%rsi,2), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: movzwl -24(%rsp,%r10,2), %eax
+; SSE3-NEXT: movd %eax, %xmm1
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
+; SSE3-NEXT: movzwl -24(%rsp,%r9,2), %eax
+; SSE3-NEXT: movd %eax, %xmm3
+; SSE3-NEXT: movzwl -24(%rsp,%r8,2), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; SSE3-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
+; SSE3-NEXT: retq
+;
+; SSSE3-LABEL: var_shuffle_v8i16:
+; SSSE3: # %bb.0:
+; SSSE3-NEXT: pmullw {{.*}}(%rip), %xmm1
+; SSSE3-NEXT: paddw {{.*}}(%rip), %xmm1
+; SSSE3-NEXT: pshufb %xmm1, %xmm0
+; SSSE3-NEXT: retq
+;
+; SSE41-LABEL: var_shuffle_v8i16:
+; SSE41: # %bb.0:
+; SSE41-NEXT: pmullw {{.*}}(%rip), %xmm1
+; SSE41-NEXT: paddw {{.*}}(%rip), %xmm1
+; SSE41-NEXT: pshufb %xmm1, %xmm0
+; SSE41-NEXT: retq
;
; AVXNOVLBW-LABEL: var_shuffle_v8i16:
; AVXNOVLBW: # %bb.0:
}
define <16 x i8> @var_shuffle_v16i8(<16 x i8> %v, <16 x i8> %indices) nounwind {
-; SSE-LABEL: var_shuffle_v16i8:
-; SSE: # %bb.0:
-; SSE-NEXT: pshufb %xmm1, %xmm0
-; SSE-NEXT: retq
+; SSE3-LABEL: var_shuffle_v16i8:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movaps %xmm1, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm8
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm15
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm9
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm3
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm10
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm7
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm11
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm6
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm12
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm5
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm13
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm4
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm14
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm1
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm2
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm15 = xmm15[0],xmm8[0],xmm15[1],xmm8[1],xmm15[2],xmm8[2],xmm15[3],xmm8[3],xmm15[4],xmm8[4],xmm15[5],xmm8[5],xmm15[6],xmm8[6],xmm15[7],xmm8[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm9[0],xmm3[1],xmm9[1],xmm3[2],xmm9[2],xmm3[3],xmm9[3],xmm3[4],xmm9[4],xmm3[5],xmm9[5],xmm3[6],xmm9[6],xmm3[7],xmm9[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm15[0],xmm3[1],xmm15[1],xmm3[2],xmm15[2],xmm3[3],xmm15[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm10[0],xmm7[1],xmm10[1],xmm7[2],xmm10[2],xmm7[3],xmm10[3],xmm7[4],xmm10[4],xmm7[5],xmm10[5],xmm7[6],xmm10[6],xmm7[7],xmm10[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm11[0],xmm6[1],xmm11[1],xmm6[2],xmm11[2],xmm6[3],xmm11[3],xmm6[4],xmm11[4],xmm6[5],xmm11[5],xmm6[6],xmm11[6],xmm6[7],xmm11[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1],xmm6[2],xmm7[2],xmm6[3],xmm7[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm12[0],xmm5[1],xmm12[1],xmm5[2],xmm12[2],xmm5[3],xmm12[3],xmm5[4],xmm12[4],xmm5[5],xmm12[5],xmm5[6],xmm12[6],xmm5[7],xmm12[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm13[0],xmm4[1],xmm13[1],xmm4[2],xmm13[2],xmm4[3],xmm13[3],xmm4[4],xmm13[4],xmm4[5],xmm13[5],xmm4[6],xmm13[6],xmm4[7],xmm13[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1],xmm4[2],xmm5[2],xmm4[3],xmm5[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm14[0],xmm1[1],xmm14[1],xmm1[2],xmm14[2],xmm1[3],xmm14[3],xmm1[4],xmm14[4],xmm1[5],xmm14[5],xmm1[6],xmm14[6],xmm1[7],xmm14[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
+; SSE3-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm6[0]
+; SSE3-NEXT: retq
+;
+; SSSE3-LABEL: var_shuffle_v16i8:
+; SSSE3: # %bb.0:
+; SSSE3-NEXT: pshufb %xmm1, %xmm0
+; SSSE3-NEXT: retq
+;
+; SSE41-LABEL: var_shuffle_v16i8:
+; SSE41: # %bb.0:
+; SSE41-NEXT: pshufb %xmm1, %xmm0
+; SSE41-NEXT: retq
;
; AVX-LABEL: var_shuffle_v16i8:
; AVX: # %bb.0:
}
define <2 x double> @var_shuffle_v2f64(<2 x double> %v, <2 x i64> %indices) nounwind {
+; SSE3-LABEL: var_shuffle_v2f64:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movq %xmm1, %rax
+; SSE3-NEXT: andl $1, %eax
+; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
+; SSE3-NEXT: movq %xmm1, %rcx
+; SSE3-NEXT: andl $1, %ecx
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE3-NEXT: movhpd {{.*#+}} xmm0 = xmm0[0],mem[0]
+; SSE3-NEXT: retq
+;
; SSSE3-LABEL: var_shuffle_v2f64:
; SSSE3: # %bb.0:
; SSSE3-NEXT: movq %xmm1, %rax
}
define <4 x float> @var_shuffle_v4f32(<4 x float> %v, <4 x i32> %indices) nounwind {
+; SSE3-LABEL: var_shuffle_v4f32:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movd %xmm1, %eax
+; SSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,2,3]
+; SSE3-NEXT: movd %xmm2, %ecx
+; SSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,0,1]
+; SSE3-NEXT: movd %xmm2, %edx
+; SSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[3,1,2,3]
+; SSE3-NEXT: movd %xmm1, %esi
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: andl $3, %eax
+; SSE3-NEXT: andl $3, %ecx
+; SSE3-NEXT: andl $3, %edx
+; SSE3-NEXT: andl $3, %esi
+; SSE3-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE3-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
+; SSE3-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
+; SSE3-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE3-NEXT: movss {{.*#+}} xmm2 = mem[0],zero,zero,zero
+; SSE3-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
+; SSE3-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
+; SSE3-NEXT: retq
+;
; SSSE3-LABEL: var_shuffle_v4f32:
; SSSE3: # %bb.0:
; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [67372036,67372036,67372036,67372036]
}
define <16 x i8> @var_shuffle_v16i8_from_v16i8_v32i8(<16 x i8> %v, <32 x i8> %indices) nounwind {
-; SSE-LABEL: var_shuffle_v16i8_from_v16i8_v32i8:
-; SSE: # %bb.0:
-; SSE-NEXT: pshufb %xmm1, %xmm0
-; SSE-NEXT: retq
+; SSE3-LABEL: var_shuffle_v16i8_from_v16i8_v32i8:
+; SSE3: # %bb.0:
+; SSE3-NEXT: movaps %xmm1, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, -{{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm8
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm15
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm9
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm3
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm10
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm7
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm11
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm6
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm12
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm5
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm13
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm4
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm14
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm1
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm2
+; SSE3-NEXT: movzbl -{{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: andl $15, %eax
+; SSE3-NEXT: movzbl -24(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm15 = xmm15[0],xmm8[0],xmm15[1],xmm8[1],xmm15[2],xmm8[2],xmm15[3],xmm8[3],xmm15[4],xmm8[4],xmm15[5],xmm8[5],xmm15[6],xmm8[6],xmm15[7],xmm8[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm9[0],xmm3[1],xmm9[1],xmm3[2],xmm9[2],xmm3[3],xmm9[3],xmm3[4],xmm9[4],xmm3[5],xmm9[5],xmm3[6],xmm9[6],xmm3[7],xmm9[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm15[0],xmm3[1],xmm15[1],xmm3[2],xmm15[2],xmm3[3],xmm15[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm10[0],xmm7[1],xmm10[1],xmm7[2],xmm10[2],xmm7[3],xmm10[3],xmm7[4],xmm10[4],xmm7[5],xmm10[5],xmm7[6],xmm10[6],xmm7[7],xmm10[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm11[0],xmm6[1],xmm11[1],xmm6[2],xmm11[2],xmm6[3],xmm11[3],xmm6[4],xmm11[4],xmm6[5],xmm11[5],xmm6[6],xmm11[6],xmm6[7],xmm11[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1],xmm6[2],xmm7[2],xmm6[3],xmm7[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm12[0],xmm5[1],xmm12[1],xmm5[2],xmm12[2],xmm5[3],xmm12[3],xmm5[4],xmm12[4],xmm5[5],xmm12[5],xmm5[6],xmm12[6],xmm5[7],xmm12[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm13[0],xmm4[1],xmm13[1],xmm4[2],xmm13[2],xmm4[3],xmm13[3],xmm4[4],xmm13[4],xmm4[5],xmm13[5],xmm4[6],xmm13[6],xmm4[7],xmm13[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1],xmm4[2],xmm5[2],xmm4[3],xmm5[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm14[0],xmm1[1],xmm14[1],xmm1[2],xmm14[2],xmm1[3],xmm14[3],xmm1[4],xmm14[4],xmm1[5],xmm14[5],xmm1[6],xmm14[6],xmm1[7],xmm14[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
+; SSE3-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm6[0]
+; SSE3-NEXT: retq
+;
+; SSSE3-LABEL: var_shuffle_v16i8_from_v16i8_v32i8:
+; SSSE3: # %bb.0:
+; SSSE3-NEXT: pshufb %xmm1, %xmm0
+; SSSE3-NEXT: retq
+;
+; SSE41-LABEL: var_shuffle_v16i8_from_v16i8_v32i8:
+; SSE41: # %bb.0:
+; SSE41-NEXT: pshufb %xmm1, %xmm0
+; SSE41-NEXT: retq
;
; AVX-LABEL: var_shuffle_v16i8_from_v16i8_v32i8:
; AVX: # %bb.0:
}
define <16 x i8> @var_shuffle_v16i8_from_v32i8_v16i8(<32 x i8> %v, <16 x i8> %indices) nounwind {
+; SSE3-LABEL: var_shuffle_v16i8_from_v32i8_v16i8:
+; SSE3: # %bb.0:
+; SSE3-NEXT: pushq %rbp
+; SSE3-NEXT: movq %rsp, %rbp
+; SSE3-NEXT: pushq %r15
+; SSE3-NEXT: pushq %r14
+; SSE3-NEXT: pushq %r13
+; SSE3-NEXT: pushq %r12
+; SSE3-NEXT: pushq %rbx
+; SSE3-NEXT: andq $-32, %rsp
+; SSE3-NEXT: subq $608, %rsp # imm = 0x260
+; SSE3-NEXT: movaps %xmm2, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: movq %rax, {{[0-9]+}}(%rsp) # 8-byte Spill
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: movq %rax, {{[0-9]+}}(%rsp) # 8-byte Spill
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: movq %rax, {{[0-9]+}}(%rsp) # 8-byte Spill
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r11d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r14d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r15d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r12d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r13d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r10d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r8d
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %edi
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %esi
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %ecx
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %edx
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %eax
+; SSE3-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
+; SSE3-NEXT: movzbl {{[0-9]+}}(%rsp), %r9d
+; SSE3-NEXT: andl $31, %r9d
+; SSE3-NEXT: movzbl 64(%rsp,%r9), %ebx
+; SSE3-NEXT: movd %ebx, %xmm8
+; SSE3-NEXT: andl $31, %eax
+; SSE3-NEXT: movzbl 96(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm15
+; SSE3-NEXT: andl $31, %edx
+; SSE3-NEXT: movzbl 128(%rsp,%rdx), %eax
+; SSE3-NEXT: movd %eax, %xmm9
+; SSE3-NEXT: andl $31, %ecx
+; SSE3-NEXT: movzbl 160(%rsp,%rcx), %eax
+; SSE3-NEXT: movd %eax, %xmm3
+; SSE3-NEXT: andl $31, %esi
+; SSE3-NEXT: movzbl 192(%rsp,%rsi), %eax
+; SSE3-NEXT: movd %eax, %xmm10
+; SSE3-NEXT: andl $31, %edi
+; SSE3-NEXT: movzbl 224(%rsp,%rdi), %eax
+; SSE3-NEXT: movd %eax, %xmm7
+; SSE3-NEXT: andl $31, %r8d
+; SSE3-NEXT: movzbl 256(%rsp,%r8), %eax
+; SSE3-NEXT: movd %eax, %xmm11
+; SSE3-NEXT: andl $31, %r10d
+; SSE3-NEXT: movzbl 288(%rsp,%r10), %eax
+; SSE3-NEXT: movd %eax, %xmm6
+; SSE3-NEXT: andl $31, %r13d
+; SSE3-NEXT: movzbl 320(%rsp,%r13), %eax
+; SSE3-NEXT: movd %eax, %xmm12
+; SSE3-NEXT: andl $31, %r12d
+; SSE3-NEXT: movzbl 352(%rsp,%r12), %eax
+; SSE3-NEXT: movd %eax, %xmm5
+; SSE3-NEXT: andl $31, %r15d
+; SSE3-NEXT: movzbl 384(%rsp,%r15), %eax
+; SSE3-NEXT: movd %eax, %xmm13
+; SSE3-NEXT: andl $31, %r14d
+; SSE3-NEXT: movzbl 416(%rsp,%r14), %eax
+; SSE3-NEXT: movd %eax, %xmm4
+; SSE3-NEXT: andl $31, %r11d
+; SSE3-NEXT: movzbl 448(%rsp,%r11), %eax
+; SSE3-NEXT: movd %eax, %xmm14
+; SSE3-NEXT: movq {{[0-9]+}}(%rsp), %rax # 8-byte Reload
+; SSE3-NEXT: andl $31, %eax
+; SSE3-NEXT: movzbl 480(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm1
+; SSE3-NEXT: movq {{[0-9]+}}(%rsp), %rax # 8-byte Reload
+; SSE3-NEXT: andl $31, %eax
+; SSE3-NEXT: movzbl 512(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm2
+; SSE3-NEXT: movq {{[0-9]+}}(%rsp), %rax # 8-byte Reload
+; SSE3-NEXT: andl $31, %eax
+; SSE3-NEXT: movzbl 544(%rsp,%rax), %eax
+; SSE3-NEXT: movd %eax, %xmm0
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm15 = xmm15[0],xmm8[0],xmm15[1],xmm8[1],xmm15[2],xmm8[2],xmm15[3],xmm8[3],xmm15[4],xmm8[4],xmm15[5],xmm8[5],xmm15[6],xmm8[6],xmm15[7],xmm8[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0],xmm9[0],xmm3[1],xmm9[1],xmm3[2],xmm9[2],xmm3[3],xmm9[3],xmm3[4],xmm9[4],xmm3[5],xmm9[5],xmm3[6],xmm9[6],xmm3[7],xmm9[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm3 = xmm3[0],xmm15[0],xmm3[1],xmm15[1],xmm3[2],xmm15[2],xmm3[3],xmm15[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm7 = xmm7[0],xmm10[0],xmm7[1],xmm10[1],xmm7[2],xmm10[2],xmm7[3],xmm10[3],xmm7[4],xmm10[4],xmm7[5],xmm10[5],xmm7[6],xmm10[6],xmm7[7],xmm10[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm6 = xmm6[0],xmm11[0],xmm6[1],xmm11[1],xmm6[2],xmm11[2],xmm6[3],xmm11[3],xmm6[4],xmm11[4],xmm6[5],xmm11[5],xmm6[6],xmm11[6],xmm6[7],xmm11[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1],xmm6[2],xmm7[2],xmm6[3],xmm7[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm5 = xmm5[0],xmm12[0],xmm5[1],xmm12[1],xmm5[2],xmm12[2],xmm5[3],xmm12[3],xmm5[4],xmm12[4],xmm5[5],xmm12[5],xmm5[6],xmm12[6],xmm5[7],xmm12[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm4 = xmm4[0],xmm13[0],xmm4[1],xmm13[1],xmm4[2],xmm13[2],xmm4[3],xmm13[3],xmm4[4],xmm13[4],xmm4[5],xmm13[5],xmm4[6],xmm13[6],xmm4[7],xmm13[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1],xmm4[2],xmm5[2],xmm4[3],xmm5[3]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm14[0],xmm1[1],xmm14[1],xmm1[2],xmm14[2],xmm1[3],xmm14[3],xmm1[4],xmm14[4],xmm1[5],xmm14[5],xmm1[6],xmm14[6],xmm1[7],xmm14[7]
+; SSE3-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1],xmm0[2],xmm2[2],xmm0[3],xmm2[3],xmm0[4],xmm2[4],xmm0[5],xmm2[5],xmm0[6],xmm2[6],xmm0[7],xmm2[7]
+; SSE3-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
+; SSE3-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm6[0]
+; SSE3-NEXT: leaq -40(%rbp), %rsp
+; SSE3-NEXT: popq %rbx
+; SSE3-NEXT: popq %r12
+; SSE3-NEXT: popq %r13
+; SSE3-NEXT: popq %r14
+; SSE3-NEXT: popq %r15
+; SSE3-NEXT: popq %rbp
+; SSE3-NEXT: retq
+;
; SSSE3-LABEL: var_shuffle_v16i8_from_v32i8_v16i8:
; SSSE3: # %bb.0:
; SSSE3-NEXT: pushq %rbp