1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512F
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=AVX512BW
6 define <64 x i8> @add_v64i8_broadcasts(<64 x i8> %a0, i64 %a1, i8 %a2) {
7 ; AVX512F-LABEL: add_v64i8_broadcasts:
9 ; AVX512F-NEXT: movq %rdi, %rax
10 ; AVX512F-NEXT: movl %edi, %ecx
11 ; AVX512F-NEXT: kmovw %edi, %k1
12 ; AVX512F-NEXT: shrq $32, %rdi
13 ; AVX512F-NEXT: shrq $48, %rax
14 ; AVX512F-NEXT: shrl $16, %ecx
15 ; AVX512F-NEXT: vmovd %esi, %xmm1
16 ; AVX512F-NEXT: vpbroadcastb %xmm1, %ymm1
17 ; AVX512F-NEXT: vinserti64x4 $1, %ymm1, %zmm1, %zmm1
18 ; AVX512F-NEXT: kmovw %ecx, %k2
19 ; AVX512F-NEXT: kmovw %eax, %k3
20 ; AVX512F-NEXT: kmovw %edi, %k4
21 ; AVX512F-NEXT: vpternlogd $255, %zmm2, %zmm2, %zmm2 {%k4} {z}
22 ; AVX512F-NEXT: vpmovdb %zmm2, %xmm2
23 ; AVX512F-NEXT: vpternlogd $255, %zmm3, %zmm3, %zmm3 {%k3} {z}
24 ; AVX512F-NEXT: vpmovdb %zmm3, %xmm3
25 ; AVX512F-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
26 ; AVX512F-NEXT: vpternlogd $255, %zmm3, %zmm3, %zmm3 {%k1} {z}
27 ; AVX512F-NEXT: vpmovdb %zmm3, %xmm3
28 ; AVX512F-NEXT: vpternlogd $255, %zmm4, %zmm4, %zmm4 {%k2} {z}
29 ; AVX512F-NEXT: vpmovdb %zmm4, %xmm4
30 ; AVX512F-NEXT: vinserti128 $1, %xmm4, %ymm3, %ymm3
31 ; AVX512F-NEXT: vinserti64x4 $1, %ymm2, %zmm3, %zmm2
32 ; AVX512F-NEXT: vpternlogq $216, %zmm2, %zmm1, %zmm0
33 ; AVX512F-NEXT: vpaddb %ymm1, %ymm0, %ymm3
34 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm0
35 ; AVX512F-NEXT: vpaddb %ymm1, %ymm0, %ymm0
36 ; AVX512F-NEXT: vinserti64x4 $1, %ymm0, %zmm3, %zmm4
37 ; AVX512F-NEXT: vpaddb %ymm1, %ymm0, %ymm0
38 ; AVX512F-NEXT: vpaddb %ymm1, %ymm3, %ymm1
39 ; AVX512F-NEXT: vinserti64x4 $1, %ymm0, %zmm1, %zmm0
40 ; AVX512F-NEXT: vpternlogq $226, %zmm4, %zmm2, %zmm0
43 ; AVX512BW-LABEL: add_v64i8_broadcasts:
45 ; AVX512BW-NEXT: vpbroadcastb %esi, %zmm1
46 ; AVX512BW-NEXT: kmovq %rdi, %k1
47 ; AVX512BW-NEXT: vpbroadcastb %esi, %zmm0 {%k1}
48 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0
49 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm0 {%k1}
51 %v = insertelement <64 x i8> undef, i8 %a2, i64 0
52 %broadcast = shufflevector <64 x i8> %v, <64 x i8> poison, <64 x i32> zeroinitializer
53 %mask = bitcast i64 %a1 to <64 x i1>
54 %broadcast_mask = select <64 x i1> %mask, <64 x i8> %broadcast, <64 x i8> %a0
55 %broadcast_maskz = select <64 x i1> %mask, <64 x i8> %broadcast, <64 x i8> zeroinitializer
56 %add0 = add <64 x i8> %broadcast_mask, %broadcast
57 %add1 = add <64 x i8> %add0, %broadcast_maskz