• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown -mattr=+avx512cd,+avx512vl | FileCheck %s --check-prefixes=CHECK,X86
3; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512cd,+avx512vl | FileCheck %s --check-prefixes=CHECK,X64
4
5declare <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32>, <4 x i32>, i8)
6
7define <4 x i32>@test_int_x86_avx512_mask_vplzcnt_d_128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2) {
8; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_d_128:
9; X86:       # %bb.0:
10; X86-NEXT:    vplzcntd %xmm0, %xmm2
11; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
12; X86-NEXT:    kmovw %eax, %k1
13; X86-NEXT:    vplzcntd %xmm0, %xmm1 {%k1}
14; X86-NEXT:    vplzcntd %xmm0, %xmm0 {%k1} {z}
15; X86-NEXT:    vpaddd %xmm0, %xmm2, %xmm0
16; X86-NEXT:    vpaddd %xmm0, %xmm1, %xmm0
17; X86-NEXT:    retl
18;
19; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_d_128:
20; X64:       # %bb.0:
21; X64-NEXT:    vplzcntd %xmm0, %xmm2
22; X64-NEXT:    kmovw %edi, %k1
23; X64-NEXT:    vplzcntd %xmm0, %xmm1 {%k1}
24; X64-NEXT:    vplzcntd %xmm0, %xmm0 {%k1} {z}
25; X64-NEXT:    vpaddd %xmm0, %xmm2, %xmm0
26; X64-NEXT:    vpaddd %xmm0, %xmm1, %xmm0
27; X64-NEXT:    retq
28  %res = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 %x2)
29  %res1 = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> %x1, i8 -1)
30  %res3 = call <4 x i32> @llvm.x86.avx512.mask.lzcnt.d.128(<4 x i32> %x0, <4 x i32> zeroinitializer, i8 %x2)
31  %res2 = add <4 x i32> %res, %res1
32  %res4 = add <4 x i32> %res2, %res3
33  ret <4 x i32> %res4
34}
35
36declare <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32>, <8 x i32>, i8)
37
38define <8 x i32>@test_int_x86_avx512_mask_vplzcnt_d_256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2) {
39; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_d_256:
40; X86:       # %bb.0:
41; X86-NEXT:    vplzcntd %ymm0, %ymm2
42; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
43; X86-NEXT:    kmovw %eax, %k1
44; X86-NEXT:    vplzcntd %ymm0, %ymm1 {%k1}
45; X86-NEXT:    vpaddd %ymm2, %ymm1, %ymm0
46; X86-NEXT:    retl
47;
48; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_d_256:
49; X64:       # %bb.0:
50; X64-NEXT:    vplzcntd %ymm0, %ymm2
51; X64-NEXT:    kmovw %edi, %k1
52; X64-NEXT:    vplzcntd %ymm0, %ymm1 {%k1}
53; X64-NEXT:    vpaddd %ymm2, %ymm1, %ymm0
54; X64-NEXT:    retq
55  %res = call <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 %x2)
56  %res1 = call <8 x i32> @llvm.x86.avx512.mask.lzcnt.d.256(<8 x i32> %x0, <8 x i32> %x1, i8 -1)
57  %res2 = add <8 x i32> %res, %res1
58  ret <8 x i32> %res2
59}
60
61declare <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64>, <2 x i64>, i8)
62
63define <2 x i64>@test_int_x86_avx512_mask_vplzcnt_q_128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2) {
64; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_q_128:
65; X86:       # %bb.0:
66; X86-NEXT:    vplzcntq %xmm0, %xmm2
67; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
68; X86-NEXT:    kmovw %eax, %k1
69; X86-NEXT:    vplzcntq %xmm0, %xmm1 {%k1}
70; X86-NEXT:    vpaddq %xmm2, %xmm1, %xmm0
71; X86-NEXT:    retl
72;
73; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_q_128:
74; X64:       # %bb.0:
75; X64-NEXT:    vplzcntq %xmm0, %xmm2
76; X64-NEXT:    kmovw %edi, %k1
77; X64-NEXT:    vplzcntq %xmm0, %xmm1 {%k1}
78; X64-NEXT:    vpaddq %xmm2, %xmm1, %xmm0
79; X64-NEXT:    retq
80  %res = call <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 %x2)
81  %res1 = call <2 x i64> @llvm.x86.avx512.mask.lzcnt.q.128(<2 x i64> %x0, <2 x i64> %x1, i8 -1)
82  %res2 = add <2 x i64> %res, %res1
83  ret <2 x i64> %res2
84}
85
86declare <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64>, <4 x i64>, i8)
87
88define <4 x i64>@test_int_x86_avx512_mask_vplzcnt_q_256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2) {
89; X86-LABEL: test_int_x86_avx512_mask_vplzcnt_q_256:
90; X86:       # %bb.0:
91; X86-NEXT:    vplzcntq %ymm0, %ymm2
92; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
93; X86-NEXT:    kmovw %eax, %k1
94; X86-NEXT:    vplzcntq %ymm0, %ymm1 {%k1}
95; X86-NEXT:    vpaddq %ymm2, %ymm1, %ymm0
96; X86-NEXT:    retl
97;
98; X64-LABEL: test_int_x86_avx512_mask_vplzcnt_q_256:
99; X64:       # %bb.0:
100; X64-NEXT:    vplzcntq %ymm0, %ymm2
101; X64-NEXT:    kmovw %edi, %k1
102; X64-NEXT:    vplzcntq %ymm0, %ymm1 {%k1}
103; X64-NEXT:    vpaddq %ymm2, %ymm1, %ymm0
104; X64-NEXT:    retq
105  %res = call <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 %x2)
106  %res1 = call <4 x i64> @llvm.x86.avx512.mask.lzcnt.q.256(<4 x i64> %x0, <4 x i64> %x1, i8 -1)
107  %res2 = add <4 x i64> %res, %res1
108  ret <4 x i64> %res2
109}
110
111define <8 x i32> @test_x86_vbroadcastmw_256(i16 %a0) {
112; X86-LABEL: test_x86_vbroadcastmw_256:
113; X86:       # %bb.0:
114; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
115; X86-NEXT:    vpbroadcastd %eax, %ymm0
116; X86-NEXT:    retl
117;
118; X64-LABEL: test_x86_vbroadcastmw_256:
119; X64:       # %bb.0:
120; X64-NEXT:    movzwl %di, %eax
121; X64-NEXT:    vpbroadcastd %eax, %ymm0
122; X64-NEXT:    retq
123  %res = call <8 x i32> @llvm.x86.avx512.broadcastmw.256(i16 %a0) ;
124  ret <8 x i32> %res
125}
126declare <8 x i32> @llvm.x86.avx512.broadcastmw.256(i16)
127
128define <4 x i32> @test_x86_vbroadcastmw_128(i16 %a0) {
129; X86-LABEL: test_x86_vbroadcastmw_128:
130; X86:       # %bb.0:
131; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
132; X86-NEXT:    vpbroadcastd %eax, %xmm0
133; X86-NEXT:    retl
134;
135; X64-LABEL: test_x86_vbroadcastmw_128:
136; X64:       # %bb.0:
137; X64-NEXT:    movzwl %di, %eax
138; X64-NEXT:    vpbroadcastd %eax, %xmm0
139; X64-NEXT:    retq
140  %res = call <4 x i32> @llvm.x86.avx512.broadcastmw.128(i16 %a0) ;
141  ret <4 x i32> %res
142}
143declare <4 x i32> @llvm.x86.avx512.broadcastmw.128(i16)
144
145define <4 x i64> @test_x86_broadcastmb_256(i8 %a0) {
146; X86-LABEL: test_x86_broadcastmb_256:
147; X86:       # %bb.0:
148; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
149; X86-NEXT:    vmovd %eax, %xmm0
150; X86-NEXT:    vpbroadcastq %xmm0, %ymm0
151; X86-NEXT:    retl
152;
153; X64-LABEL: test_x86_broadcastmb_256:
154; X64:       # %bb.0:
155; X64-NEXT:    # kill: def $edi killed $edi def $rdi
156; X64-NEXT:    movzbl %dil, %eax
157; X64-NEXT:    vpbroadcastq %rax, %ymm0
158; X64-NEXT:    retq
159  %res = call <4 x i64> @llvm.x86.avx512.broadcastmb.256(i8 %a0) ;
160  ret <4 x i64> %res
161}
162declare <4 x i64> @llvm.x86.avx512.broadcastmb.256(i8)
163
164define <2 x i64> @test_x86_broadcastmb_128(i8 %a0) {
165; X86-LABEL: test_x86_broadcastmb_128:
166; X86:       # %bb.0:
167; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
168; X86-NEXT:    vmovd %eax, %xmm0
169; X86-NEXT:    vpbroadcastq %xmm0, %xmm0
170; X86-NEXT:    retl
171;
172; X64-LABEL: test_x86_broadcastmb_128:
173; X64:       # %bb.0:
174; X64-NEXT:    # kill: def $edi killed $edi def $rdi
175; X64-NEXT:    movzbl %dil, %eax
176; X64-NEXT:    vpbroadcastq %rax, %xmm0
177; X64-NEXT:    retq
178  %res = call <2 x i64> @llvm.x86.avx512.broadcastmb.128(i8 %a0) ;
179  ret <2 x i64> %res
180}
181declare <2 x i64> @llvm.x86.avx512.broadcastmb.128(i8)
182
183