xref: /llvm-project/llvm/test/Analysis/CostModel/X86/select.ll (revision 1ad18b5968124abcd67e0210b8c508bbae74407e)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s -check-prefixes=SSE
3; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+sse4.1 | FileCheck %s -check-prefixes=SSE
4; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx | FileCheck %s -check-prefixes=AVX,AVX1
5; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s -check-prefixes=AVX,AVX2
6; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx512f,+avx512vl  | FileCheck %s -check-prefixes=AVX512,AVX512F
7; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mattr=+avx512bw,+avx512vl | FileCheck %s -check-prefixes=AVX512,AVX512BW
8;
9; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=slm | FileCheck %s --check-prefixes=SLM
10; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=goldmont | FileCheck %s --check-prefixes=SSE
11; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-- -mcpu=btver2 | FileCheck %s --check-prefixes=AVX,AVX1
12
13; Verify the cost of vector select instructions.
14
15define i32 @test_select() {
16; SSE-LABEL: 'test_select'
17; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
18; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
19; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
20; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
21; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
22; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
23; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
24; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
25; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
26; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
27; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
28; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
29; SSE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
30; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
31; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
32; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
33; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
34;
35; AVX1-LABEL: 'test_select'
36; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
37; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
38; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
39; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
40; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
41; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
42; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
43; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
44; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
45; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
46; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
47; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
48; AVX1-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
49; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
50; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
51; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
52; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
53;
54; AVX2-LABEL: 'test_select'
55; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
56; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
57; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
58; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
59; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
60; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
61; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
62; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
63; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
64; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
65; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
66; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
67; AVX2-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
68; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
69; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
70; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
71; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
72;
73; AVX512F-LABEL: 'test_select'
74; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
75; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
76; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
77; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
78; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
79; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
80; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
81; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
82; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
83; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
84; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
85; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
86; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
87; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
88; AVX512F-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
89; AVX512F-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
90; AVX512F-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
91;
92; AVX512BW-LABEL: 'test_select'
93; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
94; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
95; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
96; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
97; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
98; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
99; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
100; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
101; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
102; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
103; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
104; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
105; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
106; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
107; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
108; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
109; AVX512BW-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
110;
111; SLM-LABEL: 'test_select'
112; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
113; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
114; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
115; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
116; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
117; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
118; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
119; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
120; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
121; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
122; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
123; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
124; SLM-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
125; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
126; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
127; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
128; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
129;
130  %I64 = select i1 undef, i64 undef, i64 undef
131  %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
132  %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
133  %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
134
135  %I32 = select i1 undef, i32 undef, i32 undef
136  %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
137  %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
138  %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
139
140  %I16 = select i1 undef, i16 undef, i16 undef
141  %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
142  %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
143  %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
144
145  %I8 = select i1 undef, i8 undef, i8 undef
146  %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
147  %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
148  %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
149
150  ret i32 undef
151}
152
153define i32 @test_select_fp() {
154; SSE-LABEL: 'test_select_fp'
155; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
156; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
157; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
158; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
159; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
160; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
161; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
162; SSE-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
163; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
164;
165; AVX1-LABEL: 'test_select_fp'
166; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
167; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
168; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
169; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
170; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
171; AVX1-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
172; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
173; AVX1-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
174; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
175;
176; AVX2-LABEL: 'test_select_fp'
177; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
178; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
179; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
180; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
181; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
182; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
183; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
184; AVX2-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
185; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
186;
187; AVX512-LABEL: 'test_select_fp'
188; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
189; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
190; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
191; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
192; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
193; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
194; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
195; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
196; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
197;
198; SLM-LABEL: 'test_select_fp'
199; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
200; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
201; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
202; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
203; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
204; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
205; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
206; SLM-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
207; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
208;
209  %F64 = select i1 undef, double undef, double undef
210  %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
211  %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
212  %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
213
214  %F32 = select i1 undef, float undef, float undef
215  %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
216  %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
217  %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
218
219  ret i32 undef
220}
221
222; Immediate blend instructions for <2 x double> and <4 x float> added at SSE41.
223; Integers of the same size should also use those instructions.
224
225define <2 x i64> @test_2i64(<2 x i64> %a, <2 x i64> %b) {
226; SSE-LABEL: 'test_2i64'
227; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
228; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
229;
230; AVX-LABEL: 'test_2i64'
231; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
232; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
233;
234; AVX512-LABEL: 'test_2i64'
235; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
236; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
237;
238; SLM-LABEL: 'test_2i64'
239; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
240; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
241;
242  %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
243  ret <2 x i64> %sel
244}
245
246define <2 x double> @test_2double(<2 x double> %a, <2 x double> %b) {
247; SSE-LABEL: 'test_2double'
248; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
249; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
250;
251; AVX-LABEL: 'test_2double'
252; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
253; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
254;
255; AVX512-LABEL: 'test_2double'
256; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
257; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
258;
259; SLM-LABEL: 'test_2double'
260; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
261; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
262;
263  %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
264  ret <2 x double> %sel
265}
266
267define <4 x i32> @test_4i32(<4 x i32> %a, <4 x i32> %b) {
268; SSE-LABEL: 'test_4i32'
269; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
270; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
271;
272; AVX-LABEL: 'test_4i32'
273; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
274; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
275;
276; AVX512-LABEL: 'test_4i32'
277; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
278; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
279;
280; SLM-LABEL: 'test_4i32'
281; SLM-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
282; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
283;
284  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
285  ret <4 x i32> %sel
286}
287
288define <4 x float> @test_4float(<4 x float> %a, <4 x float> %b) {
289; SSE-LABEL: 'test_4float'
290; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
291; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
292;
293; AVX-LABEL: 'test_4float'
294; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
295; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
296;
297; AVX512-LABEL: 'test_4float'
298; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
299; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
300;
301; SLM-LABEL: 'test_4float'
302; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
303; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
304;
305  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
306  ret <4 x float> %sel
307}
308
309define <16 x i8> @test_16i8(<16 x i8> %a, <16 x i8> %b) {
310; SSE-LABEL: 'test_16i8'
311; SSE-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
312; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
313;
314; AVX-LABEL: 'test_16i8'
315; AVX-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
316; AVX-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
317;
318; AVX512-LABEL: 'test_16i8'
319; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
320; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
321;
322; SLM-LABEL: 'test_16i8'
323; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
324; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
325;
326  %sel = select <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <16 x i8> %a, <16 x i8> %b
327  ret <16 x i8> %sel
328}
329
330; Immediate blend instructions for <4 x double> and <8 x float> added at AVX.
331; Integers of the same size should also use those instructions.
332
333define <4 x i64> @test_4i64(<4 x i64> %a, <4 x i64> %b) {
334; SSE-LABEL: 'test_4i64'
335; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
336; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
337;
338; AVX1-LABEL: 'test_4i64'
339; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
340; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
341;
342; AVX2-LABEL: 'test_4i64'
343; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
344; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
345;
346; AVX512-LABEL: 'test_4i64'
347; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
348; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
349;
350; SLM-LABEL: 'test_4i64'
351; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
352; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
353;
354  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
355  ret <4 x i64> %sel
356}
357
358define <4 x double> @test_4double(<4 x double> %a, <4 x double> %b) {
359; SSE-LABEL: 'test_4double'
360; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
361; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
362;
363; AVX1-LABEL: 'test_4double'
364; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
365; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
366;
367; AVX2-LABEL: 'test_4double'
368; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
369; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
370;
371; AVX512-LABEL: 'test_4double'
372; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
373; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
374;
375; SLM-LABEL: 'test_4double'
376; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
377; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
378;
379  %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
380  ret <4 x double> %sel
381}
382
383define <8 x i32> @test_8i32(<8 x i32> %a, <8 x i32> %b) {
384; SSE-LABEL: 'test_8i32'
385; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
386; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
387;
388; AVX1-LABEL: 'test_8i32'
389; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
390; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
391;
392; AVX2-LABEL: 'test_8i32'
393; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
394; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
395;
396; AVX512-LABEL: 'test_8i32'
397; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
398; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
399;
400; SLM-LABEL: 'test_8i32'
401; SLM-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
402; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
403;
404  %sel = select <8 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 false>, <8 x i32> %a, <8 x i32> %b
405  ret <8 x i32> %sel
406}
407
408define <8 x float> @test_8float(<8 x float> %a, <8 x float> %b) {
409; SSE-LABEL: 'test_8float'
410; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
411; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
412;
413; AVX1-LABEL: 'test_8float'
414; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
415; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
416;
417; AVX2-LABEL: 'test_8float'
418; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
419; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
420;
421; AVX512-LABEL: 'test_8float'
422; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
423; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
424;
425; SLM-LABEL: 'test_8float'
426; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
427; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
428;
429  %sel = select <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <8 x float> %a, <8 x float> %b
430  ret <8 x float> %sel
431}
432
433define <16 x i16> @test_16i16(<16 x i16> %a, <16 x i16> %b) {
434; SSE-LABEL: 'test_16i16'
435; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
436; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
437;
438; AVX1-LABEL: 'test_16i16'
439; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
440; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
441;
442; AVX2-LABEL: 'test_16i16'
443; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
444; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
445;
446; AVX512-LABEL: 'test_16i16'
447; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
448; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
449;
450; SLM-LABEL: 'test_16i16'
451; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
452; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
453;
454  %sel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i16> %a, <16 x i16> %b
455  ret <16 x i16> %sel
456}
457
458define <32 x i8> @test_32i8(<32 x i8> %a, <32 x i8> %b) {
459; SSE-LABEL: 'test_32i8'
460; SSE-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
461; SSE-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
462;
463; AVX1-LABEL: 'test_32i8'
464; AVX1-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
465; AVX1-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
466;
467; AVX2-LABEL: 'test_32i8'
468; AVX2-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
469; AVX2-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
470;
471; AVX512-LABEL: 'test_32i8'
472; AVX512-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
473; AVX512-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
474;
475; SLM-LABEL: 'test_32i8'
476; SLM-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
477; SLM-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
478;
479  %sel = select <32 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 false, i1 true, i1 true>, <32 x i8> %a, <32 x i8> %b
480  ret <32 x i8> %sel
481}
482
483