ret <16 x i8> %b
}
+define <8 x i8> @trunc_v8i64_v8i8(<8 x i64>* %x) nounwind "min-legal-vector-width"="256" {
+; CHECK-AVX512-LABEL: trunc_v8i64_v8i8:
+; CHECK-AVX512: # %bb.0:
+; CHECK-AVX512-NEXT: vmovdqa (%rdi), %xmm0
+; CHECK-AVX512-NEXT: vmovdqa 16(%rdi), %xmm1
+; CHECK-AVX512-NEXT: vmovdqa 32(%rdi), %xmm2
+; CHECK-AVX512-NEXT: vmovdqa 48(%rdi), %xmm3
+; CHECK-AVX512-NEXT: vmovdqa {{.*#+}} xmm4 = <u,u,0,8,u,u,u,u,u,u,u,u,u,u,u,u>
+; CHECK-AVX512-NEXT: vpshufb %xmm4, %xmm3, %xmm3
+; CHECK-AVX512-NEXT: vpshufb %xmm4, %xmm2, %xmm2
+; CHECK-AVX512-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
+; CHECK-AVX512-NEXT: vmovdqa {{.*#+}} xmm3 = <0,8,u,u,u,u,u,u,u,u,u,u,u,u,u,u>
+; CHECK-AVX512-NEXT: vpshufb %xmm3, %xmm1, %xmm1
+; CHECK-AVX512-NEXT: vpshufb %xmm3, %xmm0, %xmm0
+; CHECK-AVX512-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
+; CHECK-AVX512-NEXT: vpblendd {{.*#+}} xmm0 = xmm0[0],xmm2[1],xmm0[2,3]
+; CHECK-AVX512-NEXT: retq
+;
+; CHECK-VBMI-LABEL: trunc_v8i64_v8i8:
+; CHECK-VBMI: # %bb.0:
+; CHECK-VBMI-NEXT: vmovdqa (%rdi), %ymm1
+; CHECK-VBMI-NEXT: vpbroadcastq {{.*#+}} ymm0 = [4048780183313844224,4048780183313844224,4048780183313844224,4048780183313844224]
+; CHECK-VBMI-NEXT: vpermi2b 32(%rdi), %ymm1, %ymm0
+; CHECK-VBMI-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
+; CHECK-VBMI-NEXT: vzeroupper
+; CHECK-VBMI-NEXT: retq
+ %a = load <8 x i64>, <8 x i64>* %x
+ %b = trunc <8 x i64> %a to <8 x i8>
+ ret <8 x i8> %b
+}
+
define <8 x i16> @trunc_v8i64_v8i16(<8 x i64>* %x) nounwind "min-legal-vector-width"="256" {
; CHECK-LABEL: trunc_v8i64_v8i16:
; CHECK: # %bb.0: