ret <8 x i32> %zext
}
-define <8 x i16> @multi_use_different_sizes(<8 x i8>* %src, <8 x i32>* %dst) nounwind {
-; SSE-LABEL: multi_use_different_sizes:
+define <8 x i16> @multi_use_narrower_sizes(<8 x i8>* %src, <8 x i32>* %dst) nounwind {
+; SSE-LABEL: multi_use_narrower_sizes:
; SSE: # %bb.0:
; SSE-NEXT: movq {{.*#+}} xmm1 = mem[0],zero
; SSE-NEXT: pxor %xmm2, %xmm2
; SSE-NEXT: movdqa %xmm2, (%rsi)
; SSE-NEXT: retq
;
-; AVX-LABEL: multi_use_different_sizes:
+; AVX-LABEL: multi_use_narrower_sizes:
; AVX: # %bb.0:
; AVX-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
; AVX-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
store <8 x i32> %sext, <8 x i32>* %dst
ret <8 x i16> %zext
}
+
+define <8 x i32> @multi_use_wider_size(<8 x i8>* %src, <8 x i16>* %dst) nounwind {
+; SSE-LABEL: multi_use_wider_size:
+; SSE: # %bb.0:
+; SSE-NEXT: movq {{.*#+}} xmm2 = mem[0],zero
+; SSE-NEXT: pxor %xmm3, %xmm3
+; SSE-NEXT: movdqa %xmm2, %xmm1
+; SSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1],xmm1[2],xmm3[2],xmm1[3],xmm3[3],xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7]
+; SSE-NEXT: movdqa %xmm1, %xmm0
+; SSE-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
+; SSE-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4],xmm3[4],xmm1[5],xmm3[5],xmm1[6],xmm3[6],xmm1[7],xmm3[7]
+; SSE-NEXT: pcmpeqb %xmm3, %xmm2
+; SSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
+; SSE-NEXT: psraw $8, %xmm2
+; SSE-NEXT: movdqa %xmm2, (%rsi)
+; SSE-NEXT: retq
+;
+; AVX-LABEL: multi_use_wider_size:
+; AVX: # %bb.0:
+; AVX-NEXT: vmovq {{.*#+}} xmm1 = mem[0],zero
+; AVX-NEXT: vpmovzxbd {{.*#+}} ymm0 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero
+; AVX-NEXT: vpxor %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
+; AVX-NEXT: vpmovsxbw %xmm1, %xmm1
+; AVX-NEXT: vmovdqa %xmm1, (%rsi)
+; AVX-NEXT: retq
+ %load = load <8 x i8>, <8 x i8>* %src
+ %zext = zext <8 x i8> %load to <8 x i32>
+ %icmp = icmp eq <8 x i8> %load, zeroinitializer
+ %sext = sext <8 x i1> %icmp to <8 x i16>
+ store <8 x i16> %sext, <8 x i16>* %dst
+ ret <8 x i32> %zext
+}