xref: /llvm-project/llvm/test/Analysis/CostModel/X86/ctpop-codesize.ll (revision a0869b14cde9ed71bb4323c8717f59ee1b1e79bf)
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=-popcnt,+sse2 | FileCheck %s -check-prefixes=SSE2,NOPOPCNT
3; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+sse2 | FileCheck %s -check-prefixes=SSE2,POPCNT
4; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+sse4.2 | FileCheck %s -check-prefixes=POPCNT,SSE42
5; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx | FileCheck %s -check-prefixes=POPCNT,AVX1
6; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx2 | FileCheck %s -check-prefixes=POPCNT,AVX2
7; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx512f | FileCheck %s -check-prefixes=POPCNT,AVX512F
8; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx512vl,+avx512bw,+avx512dq | FileCheck %s -check-prefixes=POPCNT,AVX512BW
9; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx512vl,+avx512vpopcntdq | FileCheck %s -check-prefixes=POPCNT,AVX512VPOPCNT
10; RUN: opt < %s -mtriple=x86_64-unknown-linux-gnu -passes="print<cost-model>" 2>&1 -disable-output -cost-kind=code-size -mattr=+popcnt,+avx512vl,+avx512bitalg | FileCheck %s -check-prefixes=POPCNT,AVX512BITALG
11
12; Verify the cost of scalar population count instructions.
13
14declare i64 @llvm.ctpop.i64(i64)
15declare i32 @llvm.ctpop.i32(i32)
16declare i16 @llvm.ctpop.i16(i16)
17declare  i8 @llvm.ctpop.i8(i8)
18
19define i64 @var_ctpop_i64(i64 %a) {
20; NOPOPCNT-LABEL: 'var_ctpop_i64'
21; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %ctpop = call i64 @llvm.ctpop.i64(i64 %a)
22; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %ctpop
23;
24; POPCNT-LABEL: 'var_ctpop_i64'
25; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call i64 @llvm.ctpop.i64(i64 %a)
26; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %ctpop
27;
28  %ctpop = call i64 @llvm.ctpop.i64(i64 %a)
29  ret i64 %ctpop
30}
31
32define i32 @var_ctpop_i32(i32 %a) {
33; NOPOPCNT-LABEL: 'var_ctpop_i32'
34; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 15 for instruction: %ctpop = call i32 @llvm.ctpop.i32(i32 %a)
35; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %ctpop
36;
37; POPCNT-LABEL: 'var_ctpop_i32'
38; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call i32 @llvm.ctpop.i32(i32 %a)
39; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %ctpop
40;
41  %ctpop = call i32 @llvm.ctpop.i32(i32 %a)
42  ret i32 %ctpop
43}
44
45define i16 @var_ctpop_i16(i16 %a) {
46; NOPOPCNT-LABEL: 'var_ctpop_i16'
47; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 17 for instruction: %ctpop = call i16 @llvm.ctpop.i16(i16 %a)
48; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %ctpop
49;
50; POPCNT-LABEL: 'var_ctpop_i16'
51; POPCNT-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %ctpop = call i16 @llvm.ctpop.i16(i16 %a)
52; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %ctpop
53;
54  %ctpop = call i16 @llvm.ctpop.i16(i16 %a)
55  ret i16 %ctpop
56}
57
58define i8 @var_ctpop_i8(i8 %a) {
59; NOPOPCNT-LABEL: 'var_ctpop_i8'
60; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
61; NOPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %ctpop
62;
63; POPCNT-LABEL: 'var_ctpop_i8'
64; POPCNT-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
65; POPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %ctpop
66;
67  %ctpop = call i8 @llvm.ctpop.i8(i8 %a)
68  ret i8 %ctpop
69}
70
71; Verify the cost of vector population count instructions.
72
73declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)
74declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)
75declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>)
76declare <16 x i8> @llvm.ctpop.v16i8(<16 x i8>)
77
78declare <4 x i64> @llvm.ctpop.v4i64(<4 x i64>)
79declare <8 x i32> @llvm.ctpop.v8i32(<8 x i32>)
80declare <16 x i16> @llvm.ctpop.v16i16(<16 x i16>)
81declare <32 x i8> @llvm.ctpop.v32i8(<32 x i8>)
82
83declare <8 x i64> @llvm.ctpop.v8i64(<8 x i64>)
84declare <16 x i32> @llvm.ctpop.v16i32(<16 x i32>)
85declare <32 x i16> @llvm.ctpop.v32i16(<32 x i16>)
86declare <64 x i8> @llvm.ctpop.v64i8(<64 x i8>)
87
88define <2 x i64> @var_ctpop_v2i64(<2 x i64> %a) {
89; SSE2-LABEL: 'var_ctpop_v2i64'
90; SSE2-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
91; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
92;
93; SSE42-LABEL: 'var_ctpop_v2i64'
94; SSE42-NEXT:  Cost Model: Found an estimated cost of 12 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
95; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
96;
97; AVX1-LABEL: 'var_ctpop_v2i64'
98; AVX1-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
99; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
100;
101; AVX2-LABEL: 'var_ctpop_v2i64'
102; AVX2-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
103; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
104;
105; AVX512F-LABEL: 'var_ctpop_v2i64'
106; AVX512F-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
107; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
108;
109; AVX512BW-LABEL: 'var_ctpop_v2i64'
110; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
111; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
112;
113; AVX512VPOPCNT-LABEL: 'var_ctpop_v2i64'
114; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
115; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
116;
117; AVX512BITALG-LABEL: 'var_ctpop_v2i64'
118; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
119; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <2 x i64> %ctpop
120;
121  %ctpop = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
122  ret <2 x i64> %ctpop
123}
124
125define <4 x i64> @var_ctpop_v4i64(<4 x i64> %a) {
126; SSE2-LABEL: 'var_ctpop_v4i64'
127; SSE2-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
128; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
129;
130; SSE42-LABEL: 'var_ctpop_v4i64'
131; SSE42-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
132; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
133;
134; AVX1-LABEL: 'var_ctpop_v4i64'
135; AVX1-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
136; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
137;
138; AVX2-LABEL: 'var_ctpop_v4i64'
139; AVX2-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
140; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
141;
142; AVX512F-LABEL: 'var_ctpop_v4i64'
143; AVX512F-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
144; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
145;
146; AVX512BW-LABEL: 'var_ctpop_v4i64'
147; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
148; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
149;
150; AVX512VPOPCNT-LABEL: 'var_ctpop_v4i64'
151; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
152; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
153;
154; AVX512BITALG-LABEL: 'var_ctpop_v4i64'
155; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
156; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i64> %ctpop
157;
158  %ctpop = call <4 x i64> @llvm.ctpop.v4i64(<4 x i64> %a)
159  ret <4 x i64> %ctpop
160}
161
162define <8 x i64> @var_ctpop_v8i64(<8 x i64> %a) {
163; SSE2-LABEL: 'var_ctpop_v8i64'
164; SSE2-NEXT:  Cost Model: Found an estimated cost of 64 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
165; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
166;
167; SSE42-LABEL: 'var_ctpop_v8i64'
168; SSE42-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
169; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
170;
171; AVX1-LABEL: 'var_ctpop_v8i64'
172; AVX1-NEXT:  Cost Model: Found an estimated cost of 38 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
173; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
174;
175; AVX2-LABEL: 'var_ctpop_v8i64'
176; AVX2-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
177; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
178;
179; AVX512F-LABEL: 'var_ctpop_v8i64'
180; AVX512F-NEXT:  Cost Model: Found an estimated cost of 19 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
181; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
182;
183; AVX512BW-LABEL: 'var_ctpop_v8i64'
184; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
185; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
186;
187; AVX512VPOPCNT-LABEL: 'var_ctpop_v8i64'
188; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
189; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
190;
191; AVX512BITALG-LABEL: 'var_ctpop_v8i64'
192; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
193; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i64> %ctpop
194;
195  %ctpop = call <8 x i64> @llvm.ctpop.v8i64(<8 x i64> %a)
196  ret <8 x i64> %ctpop
197}
198
199define <4 x i32> @var_ctpop_v4i32(<4 x i32> %a) {
200; SSE2-LABEL: 'var_ctpop_v4i32'
201; SSE2-NEXT:  Cost Model: Found an estimated cost of 21 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
202; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
203;
204; SSE42-LABEL: 'var_ctpop_v4i32'
205; SSE42-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
206; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
207;
208; AVX1-LABEL: 'var_ctpop_v4i32'
209; AVX1-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
210; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
211;
212; AVX2-LABEL: 'var_ctpop_v4i32'
213; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
214; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
215;
216; AVX512F-LABEL: 'var_ctpop_v4i32'
217; AVX512F-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
218; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
219;
220; AVX512BW-LABEL: 'var_ctpop_v4i32'
221; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
222; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
223;
224; AVX512VPOPCNT-LABEL: 'var_ctpop_v4i32'
225; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
226; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
227;
228; AVX512BITALG-LABEL: 'var_ctpop_v4i32'
229; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
230; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <4 x i32> %ctpop
231;
232  %ctpop = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %a)
233  ret <4 x i32> %ctpop
234}
235
236define <8 x i32> @var_ctpop_v8i32(<8 x i32> %a) {
237; SSE2-LABEL: 'var_ctpop_v8i32'
238; SSE2-NEXT:  Cost Model: Found an estimated cost of 42 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
239; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
240;
241; SSE42-LABEL: 'var_ctpop_v8i32'
242; SSE42-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
243; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
244;
245; AVX1-LABEL: 'var_ctpop_v8i32'
246; AVX1-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
247; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
248;
249; AVX2-LABEL: 'var_ctpop_v8i32'
250; AVX2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
251; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
252;
253; AVX512F-LABEL: 'var_ctpop_v8i32'
254; AVX512F-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
255; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
256;
257; AVX512BW-LABEL: 'var_ctpop_v8i32'
258; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
259; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
260;
261; AVX512VPOPCNT-LABEL: 'var_ctpop_v8i32'
262; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
263; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
264;
265; AVX512BITALG-LABEL: 'var_ctpop_v8i32'
266; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
267; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i32> %ctpop
268;
269  %ctpop = call <8 x i32> @llvm.ctpop.v8i32(<8 x i32> %a)
270  ret <8 x i32> %ctpop
271}
272
273define <16 x i32> @var_ctpop_v16i32(<16 x i32> %a) {
274; SSE2-LABEL: 'var_ctpop_v16i32'
275; SSE2-NEXT:  Cost Model: Found an estimated cost of 84 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
276; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
277;
278; SSE42-LABEL: 'var_ctpop_v16i32'
279; SSE42-NEXT:  Cost Model: Found an estimated cost of 64 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
280; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
281;
282; AVX1-LABEL: 'var_ctpop_v16i32'
283; AVX1-NEXT:  Cost Model: Found an estimated cost of 54 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
284; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
285;
286; AVX2-LABEL: 'var_ctpop_v16i32'
287; AVX2-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
288; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
289;
290; AVX512F-LABEL: 'var_ctpop_v16i32'
291; AVX512F-NEXT:  Cost Model: Found an estimated cost of 27 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
292; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
293;
294; AVX512BW-LABEL: 'var_ctpop_v16i32'
295; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
296; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
297;
298; AVX512VPOPCNT-LABEL: 'var_ctpop_v16i32'
299; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
300; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
301;
302; AVX512BITALG-LABEL: 'var_ctpop_v16i32'
303; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
304; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i32> %ctpop
305;
306  %ctpop = call <16 x i32> @llvm.ctpop.v16i32(<16 x i32> %a)
307  ret <16 x i32> %ctpop
308}
309
310define <8 x i16> @var_ctpop_v8i16(<8 x i16> %a) {
311; SSE2-LABEL: 'var_ctpop_v8i16'
312; SSE2-NEXT:  Cost Model: Found an estimated cost of 18 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
313; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
314;
315; SSE42-LABEL: 'var_ctpop_v8i16'
316; SSE42-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
317; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
318;
319; AVX1-LABEL: 'var_ctpop_v8i16'
320; AVX1-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
321; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
322;
323; AVX2-LABEL: 'var_ctpop_v8i16'
324; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
325; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
326;
327; AVX512F-LABEL: 'var_ctpop_v8i16'
328; AVX512F-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
329; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
330;
331; AVX512BW-LABEL: 'var_ctpop_v8i16'
332; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
333; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
334;
335; AVX512VPOPCNT-LABEL: 'var_ctpop_v8i16'
336; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
337; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
338;
339; AVX512BITALG-LABEL: 'var_ctpop_v8i16'
340; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
341; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <8 x i16> %ctpop
342;
343  %ctpop = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %a)
344  ret <8 x i16> %ctpop
345}
346
347define <16 x i16> @var_ctpop_v16i16(<16 x i16> %a) {
348; SSE2-LABEL: 'var_ctpop_v16i16'
349; SSE2-NEXT:  Cost Model: Found an estimated cost of 36 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
350; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
351;
352; SSE42-LABEL: 'var_ctpop_v16i16'
353; SSE42-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
354; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
355;
356; AVX1-LABEL: 'var_ctpop_v16i16'
357; AVX1-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
358; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
359;
360; AVX2-LABEL: 'var_ctpop_v16i16'
361; AVX2-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
362; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
363;
364; AVX512F-LABEL: 'var_ctpop_v16i16'
365; AVX512F-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
366; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
367;
368; AVX512BW-LABEL: 'var_ctpop_v16i16'
369; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
370; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
371;
372; AVX512VPOPCNT-LABEL: 'var_ctpop_v16i16'
373; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
374; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
375;
376; AVX512BITALG-LABEL: 'var_ctpop_v16i16'
377; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
378; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i16> %ctpop
379;
380  %ctpop = call <16 x i16> @llvm.ctpop.v16i16(<16 x i16> %a)
381  ret <16 x i16> %ctpop
382}
383
384define <32 x i16> @var_ctpop_v32i16(<32 x i16> %a) {
385; SSE2-LABEL: 'var_ctpop_v32i16'
386; SSE2-NEXT:  Cost Model: Found an estimated cost of 72 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
387; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
388;
389; SSE42-LABEL: 'var_ctpop_v32i16'
390; SSE42-NEXT:  Cost Model: Found an estimated cost of 56 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
391; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
392;
393; AVX1-LABEL: 'var_ctpop_v32i16'
394; AVX1-NEXT:  Cost Model: Found an estimated cost of 44 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
395; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
396;
397; AVX2-LABEL: 'var_ctpop_v32i16'
398; AVX2-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
399; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
400;
401; AVX512F-LABEL: 'var_ctpop_v32i16'
402; AVX512F-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
403; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
404;
405; AVX512BW-LABEL: 'var_ctpop_v32i16'
406; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 11 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
407; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
408;
409; AVX512VPOPCNT-LABEL: 'var_ctpop_v32i16'
410; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 22 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
411; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
412;
413; AVX512BITALG-LABEL: 'var_ctpop_v32i16'
414; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
415; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i16> %ctpop
416;
417  %ctpop = call <32 x i16> @llvm.ctpop.v32i16(<32 x i16> %a)
418  ret <32 x i16> %ctpop
419}
420
421define <16 x i8> @var_ctpop_v16i8(<16 x i8> %a) {
422; SSE2-LABEL: 'var_ctpop_v16i8'
423; SSE2-NEXT:  Cost Model: Found an estimated cost of 14 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
424; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
425;
426; SSE42-LABEL: 'var_ctpop_v16i8'
427; SSE42-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
428; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
429;
430; AVX1-LABEL: 'var_ctpop_v16i8'
431; AVX1-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
432; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
433;
434; AVX2-LABEL: 'var_ctpop_v16i8'
435; AVX2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
436; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
437;
438; AVX512F-LABEL: 'var_ctpop_v16i8'
439; AVX512F-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
440; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
441;
442; AVX512BW-LABEL: 'var_ctpop_v16i8'
443; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
444; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
445;
446; AVX512VPOPCNT-LABEL: 'var_ctpop_v16i8'
447; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
448; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
449;
450; AVX512BITALG-LABEL: 'var_ctpop_v16i8'
451; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
452; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <16 x i8> %ctpop
453;
454  %ctpop = call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %a)
455  ret <16 x i8> %ctpop
456}
457
458define <32 x i8> @var_ctpop_v32i8(<32 x i8> %a) {
459; SSE2-LABEL: 'var_ctpop_v32i8'
460; SSE2-NEXT:  Cost Model: Found an estimated cost of 28 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
461; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
462;
463; SSE42-LABEL: 'var_ctpop_v32i8'
464; SSE42-NEXT:  Cost Model: Found an estimated cost of 20 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
465; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
466;
467; AVX1-LABEL: 'var_ctpop_v32i8'
468; AVX1-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
469; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
470;
471; AVX2-LABEL: 'var_ctpop_v32i8'
472; AVX2-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
473; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
474;
475; AVX512F-LABEL: 'var_ctpop_v32i8'
476; AVX512F-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
477; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
478;
479; AVX512BW-LABEL: 'var_ctpop_v32i8'
480; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
481; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
482;
483; AVX512VPOPCNT-LABEL: 'var_ctpop_v32i8'
484; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
485; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
486;
487; AVX512BITALG-LABEL: 'var_ctpop_v32i8'
488; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
489; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <32 x i8> %ctpop
490;
491  %ctpop = call <32 x i8> @llvm.ctpop.v32i8(<32 x i8> %a)
492  ret <32 x i8> %ctpop
493}
494
495define <64 x i8> @var_ctpop_v64i8(<64 x i8> %a) {
496; SSE2-LABEL: 'var_ctpop_v64i8'
497; SSE2-NEXT:  Cost Model: Found an estimated cost of 56 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
498; SSE2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
499;
500; SSE42-LABEL: 'var_ctpop_v64i8'
501; SSE42-NEXT:  Cost Model: Found an estimated cost of 40 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
502; SSE42-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
503;
504; AVX1-LABEL: 'var_ctpop_v64i8'
505; AVX1-NEXT:  Cost Model: Found an estimated cost of 32 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
506; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
507;
508; AVX2-LABEL: 'var_ctpop_v64i8'
509; AVX2-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
510; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
511;
512; AVX512F-LABEL: 'var_ctpop_v64i8'
513; AVX512F-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
514; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
515;
516; AVX512BW-LABEL: 'var_ctpop_v64i8'
517; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
518; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
519;
520; AVX512VPOPCNT-LABEL: 'var_ctpop_v64i8'
521; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
522; AVX512VPOPCNT-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
523;
524; AVX512BITALG-LABEL: 'var_ctpop_v64i8'
525; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
526; AVX512BITALG-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i8> %ctpop
527;
528  %ctpop = call <64 x i8> @llvm.ctpop.v64i8(<64 x i8> %a)
529  ret <64 x i8> %ctpop
530}
531