xref: /llvm-project/llvm/test/Analysis/CostModel/X86/cttz-codesize.ll (revision dec47b76f406242dfb9d36da4d7adfb171c71104)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=-bmi,+sse2 | FileCheck %s -check-prefixes=CHECK,NOBMI
3; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+sse2 | FileCheck %s -check-prefixes=CHECK,BMI,SSE2
4; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+sse4.2 | FileCheck %s -check-prefixes=CHECK,BMI,SSE42
5; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx | FileCheck %s -check-prefixes=CHECK,BMI,AVX1
6; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx2 | FileCheck %s -check-prefixes=CHECK,BMI,AVX2
7; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx512f | FileCheck %s -check-prefixes=CHECK,BMI,AVX512
8; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx512vl,+avx512bw,+avx512dq | FileCheck %s -check-prefixes=CHECK,BMI,AVX512
9; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx512vl,+avx512vpopcntdq | FileCheck %s -check-prefixes=CHECK,BMI,AVX512
10; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+bmi,+avx512vl,+avx512bitalg | FileCheck %s -check-prefixes=CHECK,BMI,AVX512
11
12; Verify the cost of scalar trailing zero count instructions.
13
14declare i64 @llvm.cttz.i64(i64, i1)
15declare i32 @llvm.cttz.i32(i32, i1)
16declare i16 @llvm.cttz.i16(i16, i1)
17declare  i8 @llvm.cttz.i8(i8, i1)
18
19define i64 @var_cttz_i64(i64 %a) {
20; NOBMI-LABEL: 'var_cttz_i64'
21; NOBMI-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 false)
22; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %cttz
23;
24; BMI-LABEL: 'var_cttz_i64'
25; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 false)
26; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %cttz
27;
28  %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 0)
29  ret i64 %cttz
30}
31
32define i64 @var_cttz_i64u(i64 %a) {
33; CHECK-LABEL: 'var_cttz_i64u'
34; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 true)
35; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %cttz
36;
37  %cttz = call i64 @llvm.cttz.i64(i64 %a, i1 1)
38  ret i64 %cttz
39}
40
41define i32 @var_cttz_i32(i32 %a) {
42; NOBMI-LABEL: 'var_cttz_i32'
43; NOBMI-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 false)
44; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %cttz
45;
46; BMI-LABEL: 'var_cttz_i32'
47; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 false)
48; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %cttz
49;
50  %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 0)
51  ret i32 %cttz
52}
53
54define i32 @var_cttz_i32u(i32 %a) {
55; CHECK-LABEL: 'var_cttz_i32u'
56; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 true)
57; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %cttz
58;
59  %cttz = call i32 @llvm.cttz.i32(i32 %a, i1 1)
60  ret i32 %cttz
61}
62
63define i16 @var_cttz_i16(i16 %a) {
64; NOBMI-LABEL: 'var_cttz_i16'
65; NOBMI-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 false)
66; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %cttz
67;
68; BMI-LABEL: 'var_cttz_i16'
69; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 false)
70; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %cttz
71;
72  %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 0)
73  ret i16 %cttz
74}
75
76define i16 @var_cttz_i16u(i16 %a) {
77; CHECK-LABEL: 'var_cttz_i16u'
78; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 true)
79; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %cttz
80;
81  %cttz = call i16 @llvm.cttz.i16(i16 %a, i1 1)
82  ret i16 %cttz
83}
84
85define i8 @var_cttz_i8(i8 %a) {
86; NOBMI-LABEL: 'var_cttz_i8'
87; NOBMI-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 false)
88; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %cttz
89;
90; BMI-LABEL: 'var_cttz_i8'
91; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 false)
92; BMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %cttz
93;
94  %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 0)
95  ret i8 %cttz
96}
97
98define i8 @var_cttz_i8u(i8 %a) {
99; CHECK-LABEL: 'var_cttz_i8u'
100; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 true)
101; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %cttz
102;
103  %cttz = call i8 @llvm.cttz.i8(i8 %a, i1 1)
104  ret i8 %cttz
105}
106
107; Verify the cost of vector trailing zero count instructions.
108
109declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)
110declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)
111declare <8 x i16> @llvm.cttz.v8i16(<8 x i16>, i1)
112declare <16 x i8> @llvm.cttz.v16i8(<16 x i8>, i1)
113
114declare <4 x i64> @llvm.cttz.v4i64(<4 x i64>, i1)
115declare <8 x i32> @llvm.cttz.v8i32(<8 x i32>, i1)
116declare <16 x i16> @llvm.cttz.v16i16(<16 x i16>, i1)
117declare <32 x i8> @llvm.cttz.v32i8(<32 x i8>, i1)
118
119declare <8 x i64> @llvm.cttz.v8i64(<8 x i64>, i1)
120declare <16 x i32> @llvm.cttz.v16i32(<16 x i32>, i1)
121declare <32 x i16> @llvm.cttz.v32i16(<32 x i16>, i1)
122declare <64 x i8> @llvm.cttz.v64i8(<64 x i8>, i1)
123
124define <2 x i64> @var_cttz_v2i64(<2 x i64> %a) {
125; NOBMI-LABEL: 'var_cttz_v2i64'
126; NOBMI-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
127; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
128;
129; SSE2-LABEL: 'var_cttz_v2i64'
130; SSE2-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
131; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
132;
133; SSE42-LABEL: 'var_cttz_v2i64'
134; SSE42-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
135; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
136;
137; AVX1-LABEL: 'var_cttz_v2i64'
138; AVX1-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
139; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
140;
141; AVX2-LABEL: 'var_cttz_v2i64'
142; AVX2-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
143; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
144;
145; AVX512-LABEL: 'var_cttz_v2i64'
146; AVX512-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 false)
147; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
148;
149  %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 0)
150  ret <2 x i64> %cttz
151}
152
153define <2 x i64> @var_cttz_v2i64u(<2 x i64> %a) {
154; NOBMI-LABEL: 'var_cttz_v2i64u'
155; NOBMI-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
156; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
157;
158; SSE2-LABEL: 'var_cttz_v2i64u'
159; SSE2-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
160; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
161;
162; SSE42-LABEL: 'var_cttz_v2i64u'
163; SSE42-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
164; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
165;
166; AVX1-LABEL: 'var_cttz_v2i64u'
167; AVX1-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
168; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
169;
170; AVX2-LABEL: 'var_cttz_v2i64u'
171; AVX2-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
172; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
173;
174; AVX512-LABEL: 'var_cttz_v2i64u'
175; AVX512-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 true)
176; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %cttz
177;
178  %cttz = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a, i1 1)
179  ret <2 x i64> %cttz
180}
181
182define <4 x i64> @var_cttz_v4i64(<4 x i64> %a) {
183; NOBMI-LABEL: 'var_cttz_v4i64'
184; NOBMI-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
185; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
186;
187; SSE2-LABEL: 'var_cttz_v4i64'
188; SSE2-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
189; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
190;
191; SSE42-LABEL: 'var_cttz_v4i64'
192; SSE42-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
193; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
194;
195; AVX1-LABEL: 'var_cttz_v4i64'
196; AVX1-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
197; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
198;
199; AVX2-LABEL: 'var_cttz_v4i64'
200; AVX2-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
201; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
202;
203; AVX512-LABEL: 'var_cttz_v4i64'
204; AVX512-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 false)
205; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
206;
207  %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 0)
208  ret <4 x i64> %cttz
209}
210
211define <4 x i64> @var_cttz_v4i64u(<4 x i64> %a) {
212; NOBMI-LABEL: 'var_cttz_v4i64u'
213; NOBMI-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
214; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
215;
216; SSE2-LABEL: 'var_cttz_v4i64u'
217; SSE2-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
218; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
219;
220; SSE42-LABEL: 'var_cttz_v4i64u'
221; SSE42-NEXT:  Cost Model: Found an estimated cost of 30 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
222; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
223;
224; AVX1-LABEL: 'var_cttz_v4i64u'
225; AVX1-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
226; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
227;
228; AVX2-LABEL: 'var_cttz_v4i64u'
229; AVX2-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
230; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
231;
232; AVX512-LABEL: 'var_cttz_v4i64u'
233; AVX512-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 true)
234; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %cttz
235;
236  %cttz = call <4 x i64> @llvm.cttz.v4i64(<4 x i64> %a, i1 1)
237  ret <4 x i64> %cttz
238}
239
240define <8 x i64> @var_cttz_v8i64(<8 x i64> %a) {
241; NOBMI-LABEL: 'var_cttz_v8i64'
242; NOBMI-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
243; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
244;
245; SSE2-LABEL: 'var_cttz_v8i64'
246; SSE2-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
247; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
248;
249; SSE42-LABEL: 'var_cttz_v8i64'
250; SSE42-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
251; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
252;
253; AVX1-LABEL: 'var_cttz_v8i64'
254; AVX1-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
255; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
256;
257; AVX2-LABEL: 'var_cttz_v8i64'
258; AVX2-NEXT:  Cost Model: Found an estimated cost of 26 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
259; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
260;
261; AVX512-LABEL: 'var_cttz_v8i64'
262; AVX512-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 false)
263; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
264;
265  %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 0)
266  ret <8 x i64> %cttz
267}
268
269define <8 x i64> @var_cttz_v8i64u(<8 x i64> %a) {
270; NOBMI-LABEL: 'var_cttz_v8i64u'
271; NOBMI-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
272; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
273;
274; SSE2-LABEL: 'var_cttz_v8i64u'
275; SSE2-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
276; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
277;
278; SSE42-LABEL: 'var_cttz_v8i64u'
279; SSE42-NEXT:  Cost Model: Found an estimated cost of 60 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
280; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
281;
282; AVX1-LABEL: 'var_cttz_v8i64u'
283; AVX1-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
284; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
285;
286; AVX2-LABEL: 'var_cttz_v8i64u'
287; AVX2-NEXT:  Cost Model: Found an estimated cost of 26 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
288; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
289;
290; AVX512-LABEL: 'var_cttz_v8i64u'
291; AVX512-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 true)
292; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %cttz
293;
294  %cttz = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %a, i1 1)
295  ret <8 x i64> %cttz
296}
297
298define <4 x i32> @var_cttz_v4i32(<4 x i32> %a) {
299; NOBMI-LABEL: 'var_cttz_v4i32'
300; NOBMI-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
301; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
302;
303; SSE2-LABEL: 'var_cttz_v4i32'
304; SSE2-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
305; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
306;
307; SSE42-LABEL: 'var_cttz_v4i32'
308; SSE42-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
309; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
310;
311; AVX1-LABEL: 'var_cttz_v4i32'
312; AVX1-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
313; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
314;
315; AVX2-LABEL: 'var_cttz_v4i32'
316; AVX2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
317; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
318;
319; AVX512-LABEL: 'var_cttz_v4i32'
320; AVX512-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 false)
321; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
322;
323  %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 0)
324  ret <4 x i32> %cttz
325}
326
327define <4 x i32> @var_cttz_v4i32u(<4 x i32> %a) {
328; NOBMI-LABEL: 'var_cttz_v4i32u'
329; NOBMI-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
330; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
331;
332; SSE2-LABEL: 'var_cttz_v4i32u'
333; SSE2-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
334; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
335;
336; SSE42-LABEL: 'var_cttz_v4i32u'
337; SSE42-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
338; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
339;
340; AVX1-LABEL: 'var_cttz_v4i32u'
341; AVX1-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
342; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
343;
344; AVX2-LABEL: 'var_cttz_v4i32u'
345; AVX2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
346; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
347;
348; AVX512-LABEL: 'var_cttz_v4i32u'
349; AVX512-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 true)
350; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %cttz
351;
352  %cttz = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %a, i1 1)
353  ret <4 x i32> %cttz
354}
355
356define <8 x i32> @var_cttz_v8i32(<8 x i32> %a) {
357; NOBMI-LABEL: 'var_cttz_v8i32'
358; NOBMI-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
359; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
360;
361; SSE2-LABEL: 'var_cttz_v8i32'
362; SSE2-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
363; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
364;
365; SSE42-LABEL: 'var_cttz_v8i32'
366; SSE42-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
367; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
368;
369; AVX1-LABEL: 'var_cttz_v8i32'
370; AVX1-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
371; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
372;
373; AVX2-LABEL: 'var_cttz_v8i32'
374; AVX2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
375; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
376;
377; AVX512-LABEL: 'var_cttz_v8i32'
378; AVX512-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 false)
379; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
380;
381  %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 0)
382  ret <8 x i32> %cttz
383}
384
385define <8 x i32> @var_cttz_v8i32u(<8 x i32> %a) {
386; NOBMI-LABEL: 'var_cttz_v8i32u'
387; NOBMI-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
388; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
389;
390; SSE2-LABEL: 'var_cttz_v8i32u'
391; SSE2-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
392; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
393;
394; SSE42-LABEL: 'var_cttz_v8i32u'
395; SSE42-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
396; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
397;
398; AVX1-LABEL: 'var_cttz_v8i32u'
399; AVX1-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
400; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
401;
402; AVX2-LABEL: 'var_cttz_v8i32u'
403; AVX2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
404; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
405;
406; AVX512-LABEL: 'var_cttz_v8i32u'
407; AVX512-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 true)
408; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %cttz
409;
410  %cttz = call <8 x i32> @llvm.cttz.v8i32(<8 x i32> %a, i1 1)
411  ret <8 x i32> %cttz
412}
413
414define <16 x i32> @var_cttz_v16i32(<16 x i32> %a) {
415; NOBMI-LABEL: 'var_cttz_v16i32'
416; NOBMI-NEXT:  Cost Model: Found an estimated cost of 96 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
417; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
418;
419; SSE2-LABEL: 'var_cttz_v16i32'
420; SSE2-NEXT:  Cost Model: Found an estimated cost of 96 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
421; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
422;
423; SSE42-LABEL: 'var_cttz_v16i32'
424; SSE42-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
425; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
426;
427; AVX1-LABEL: 'var_cttz_v16i32'
428; AVX1-NEXT:  Cost Model: Found an estimated cost of 64 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
429; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
430;
431; AVX2-LABEL: 'var_cttz_v16i32'
432; AVX2-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
433; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
434;
435; AVX512-LABEL: 'var_cttz_v16i32'
436; AVX512-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 false)
437; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
438;
439  %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 0)
440  ret <16 x i32> %cttz
441}
442
443define <16 x i32> @var_cttz_v16i32u(<16 x i32> %a) {
444; NOBMI-LABEL: 'var_cttz_v16i32u'
445; NOBMI-NEXT:  Cost Model: Found an estimated cost of 96 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
446; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
447;
448; SSE2-LABEL: 'var_cttz_v16i32u'
449; SSE2-NEXT:  Cost Model: Found an estimated cost of 96 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
450; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
451;
452; SSE42-LABEL: 'var_cttz_v16i32u'
453; SSE42-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
454; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
455;
456; AVX1-LABEL: 'var_cttz_v16i32u'
457; AVX1-NEXT:  Cost Model: Found an estimated cost of 64 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
458; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
459;
460; AVX2-LABEL: 'var_cttz_v16i32u'
461; AVX2-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
462; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
463;
464; AVX512-LABEL: 'var_cttz_v16i32u'
465; AVX512-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 true)
466; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %cttz
467;
468  %cttz = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %a, i1 1)
469  ret <16 x i32> %cttz
470}
471
472define <8 x i16> @var_cttz_v8i16(<8 x i16> %a) {
473; NOBMI-LABEL: 'var_cttz_v8i16'
474; NOBMI-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
475; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
476;
477; SSE2-LABEL: 'var_cttz_v8i16'
478; SSE2-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
479; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
480;
481; SSE42-LABEL: 'var_cttz_v8i16'
482; SSE42-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
483; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
484;
485; AVX1-LABEL: 'var_cttz_v8i16'
486; AVX1-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
487; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
488;
489; AVX2-LABEL: 'var_cttz_v8i16'
490; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
491; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
492;
493; AVX512-LABEL: 'var_cttz_v8i16'
494; AVX512-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 false)
495; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
496;
497  %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 0)
498  ret <8 x i16> %cttz
499}
500
501define <8 x i16> @var_cttz_v8i16u(<8 x i16> %a) {
502; NOBMI-LABEL: 'var_cttz_v8i16u'
503; NOBMI-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
504; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
505;
506; SSE2-LABEL: 'var_cttz_v8i16u'
507; SSE2-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
508; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
509;
510; SSE42-LABEL: 'var_cttz_v8i16u'
511; SSE42-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
512; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
513;
514; AVX1-LABEL: 'var_cttz_v8i16u'
515; AVX1-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
516; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
517;
518; AVX2-LABEL: 'var_cttz_v8i16u'
519; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
520; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
521;
522; AVX512-LABEL: 'var_cttz_v8i16u'
523; AVX512-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 true)
524; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %cttz
525;
526  %cttz = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %a, i1 1)
527  ret <8 x i16> %cttz
528}
529
530define <16 x i16> @var_cttz_v16i16(<16 x i16> %a) {
531; NOBMI-LABEL: 'var_cttz_v16i16'
532; NOBMI-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
533; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
534;
535; SSE2-LABEL: 'var_cttz_v16i16'
536; SSE2-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
537; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
538;
539; SSE42-LABEL: 'var_cttz_v16i16'
540; SSE42-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
541; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
542;
543; AVX1-LABEL: 'var_cttz_v16i16'
544; AVX1-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
545; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
546;
547; AVX2-LABEL: 'var_cttz_v16i16'
548; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
549; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
550;
551; AVX512-LABEL: 'var_cttz_v16i16'
552; AVX512-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 false)
553; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
554;
555  %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 0)
556  ret <16 x i16> %cttz
557}
558
559define <16 x i16> @var_cttz_v16i16u(<16 x i16> %a) {
560; NOBMI-LABEL: 'var_cttz_v16i16u'
561; NOBMI-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
562; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
563;
564; SSE2-LABEL: 'var_cttz_v16i16u'
565; SSE2-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
566; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
567;
568; SSE42-LABEL: 'var_cttz_v16i16u'
569; SSE42-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
570; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
571;
572; AVX1-LABEL: 'var_cttz_v16i16u'
573; AVX1-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
574; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
575;
576; AVX2-LABEL: 'var_cttz_v16i16u'
577; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
578; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
579;
580; AVX512-LABEL: 'var_cttz_v16i16u'
581; AVX512-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 true)
582; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %cttz
583;
584  %cttz = call <16 x i16> @llvm.cttz.v16i16(<16 x i16> %a, i1 1)
585  ret <16 x i16> %cttz
586}
587
588define <32 x i16> @var_cttz_v32i16(<32 x i16> %a) {
589; NOBMI-LABEL: 'var_cttz_v32i16'
590; NOBMI-NEXT:  Cost Model: Found an estimated cost of 84 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
591; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
592;
593; SSE2-LABEL: 'var_cttz_v32i16'
594; SSE2-NEXT:  Cost Model: Found an estimated cost of 84 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
595; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
596;
597; SSE42-LABEL: 'var_cttz_v32i16'
598; SSE42-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
599; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
600;
601; AVX1-LABEL: 'var_cttz_v32i16'
602; AVX1-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
603; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
604;
605; AVX2-LABEL: 'var_cttz_v32i16'
606; AVX2-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 false)
607; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
608;
609  %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 0)
610  ret <32 x i16> %cttz
611}
612
613define <32 x i16> @var_cttz_v32i16u(<32 x i16> %a) {
614; NOBMI-LABEL: 'var_cttz_v32i16u'
615; NOBMI-NEXT:  Cost Model: Found an estimated cost of 84 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
616; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
617;
618; SSE2-LABEL: 'var_cttz_v32i16u'
619; SSE2-NEXT:  Cost Model: Found an estimated cost of 84 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
620; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
621;
622; SSE42-LABEL: 'var_cttz_v32i16u'
623; SSE42-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
624; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
625;
626; AVX1-LABEL: 'var_cttz_v32i16u'
627; AVX1-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
628; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
629;
630; AVX2-LABEL: 'var_cttz_v32i16u'
631; AVX2-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 true)
632; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %cttz
633;
634  %cttz = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %a, i1 1)
635  ret <32 x i16> %cttz
636}
637
638define <16 x i8> @var_cttz_v16i8(<16 x i8> %a) {
639; NOBMI-LABEL: 'var_cttz_v16i8'
640; NOBMI-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
641; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
642;
643; SSE2-LABEL: 'var_cttz_v16i8'
644; SSE2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
645; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
646;
647; SSE42-LABEL: 'var_cttz_v16i8'
648; SSE42-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
649; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
650;
651; AVX1-LABEL: 'var_cttz_v16i8'
652; AVX1-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
653; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
654;
655; AVX2-LABEL: 'var_cttz_v16i8'
656; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
657; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
658;
659; AVX512-LABEL: 'var_cttz_v16i8'
660; AVX512-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 false)
661; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
662;
663  %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 0)
664  ret <16 x i8> %cttz
665}
666
667define <16 x i8> @var_cttz_v16i8u(<16 x i8> %a) {
668; NOBMI-LABEL: 'var_cttz_v16i8u'
669; NOBMI-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
670; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
671;
672; SSE2-LABEL: 'var_cttz_v16i8u'
673; SSE2-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
674; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
675;
676; SSE42-LABEL: 'var_cttz_v16i8u'
677; SSE42-NEXT:  Cost Model: Found an estimated cost of 13 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
678; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
679;
680; AVX1-LABEL: 'var_cttz_v16i8u'
681; AVX1-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
682; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
683;
684; AVX2-LABEL: 'var_cttz_v16i8u'
685; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
686; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
687;
688; AVX512-LABEL: 'var_cttz_v16i8u'
689; AVX512-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 true)
690; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %cttz
691;
692  %cttz = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %a, i1 1)
693  ret <16 x i8> %cttz
694}
695
696define <32 x i8> @var_cttz_v32i8(<32 x i8> %a) {
697; NOBMI-LABEL: 'var_cttz_v32i8'
698; NOBMI-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
699; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
700;
701; SSE2-LABEL: 'var_cttz_v32i8'
702; SSE2-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
703; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
704;
705; SSE42-LABEL: 'var_cttz_v32i8'
706; SSE42-NEXT:  Cost Model: Found an estimated cost of 26 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
707; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
708;
709; AVX1-LABEL: 'var_cttz_v32i8'
710; AVX1-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
711; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
712;
713; AVX2-LABEL: 'var_cttz_v32i8'
714; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
715; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
716;
717; AVX512-LABEL: 'var_cttz_v32i8'
718; AVX512-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 false)
719; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
720;
721  %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 0)
722  ret <32 x i8> %cttz
723}
724
725define <32 x i8> @var_cttz_v32i8u(<32 x i8> %a) {
726; NOBMI-LABEL: 'var_cttz_v32i8u'
727; NOBMI-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
728; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
729;
730; SSE2-LABEL: 'var_cttz_v32i8u'
731; SSE2-NEXT:  Cost Model: Found an estimated cost of 34 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
732; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
733;
734; SSE42-LABEL: 'var_cttz_v32i8u'
735; SSE42-NEXT:  Cost Model: Found an estimated cost of 26 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
736; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
737;
738; AVX1-LABEL: 'var_cttz_v32i8u'
739; AVX1-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
740; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
741;
742; AVX2-LABEL: 'var_cttz_v32i8u'
743; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
744; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
745;
746; AVX512-LABEL: 'var_cttz_v32i8u'
747; AVX512-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 true)
748; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %cttz
749;
750  %cttz = call <32 x i8> @llvm.cttz.v32i8(<32 x i8> %a, i1 1)
751  ret <32 x i8> %cttz
752}
753
754define <64 x i8> @var_cttz_v64i8(<64 x i8> %a) {
755; NOBMI-LABEL: 'var_cttz_v64i8'
756; NOBMI-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
757; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
758;
759; SSE2-LABEL: 'var_cttz_v64i8'
760; SSE2-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
761; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
762;
763; SSE42-LABEL: 'var_cttz_v64i8'
764; SSE42-NEXT:  Cost Model: Found an estimated cost of 52 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
765; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
766;
767; AVX1-LABEL: 'var_cttz_v64i8'
768; AVX1-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
769; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
770;
771; AVX2-LABEL: 'var_cttz_v64i8'
772; AVX2-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 false)
773; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
774;
775  %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 0)
776  ret <64 x i8> %cttz
777}
778
779define <64 x i8> @var_cttz_v64i8u(<64 x i8> %a) {
780; NOBMI-LABEL: 'var_cttz_v64i8u'
781; NOBMI-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
782; NOBMI-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
783;
784; SSE2-LABEL: 'var_cttz_v64i8u'
785; SSE2-NEXT:  Cost Model: Found an estimated cost of 68 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
786; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
787;
788; SSE42-LABEL: 'var_cttz_v64i8u'
789; SSE42-NEXT:  Cost Model: Found an estimated cost of 52 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
790; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
791;
792; AVX1-LABEL: 'var_cttz_v64i8u'
793; AVX1-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
794; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
795;
796; AVX2-LABEL: 'var_cttz_v64i8u'
797; AVX2-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 true)
798; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %cttz
799;
800  %cttz = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %a, i1 1)
801  ret <64 x i8> %cttz
802}
803