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-unknown-linux-gnu -mattr=+sse2 | FileCheck %s -check-prefixes=SSE
3 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mattr=+sse4.1 | FileCheck %s -check-prefixes=SSE
4 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mattr=+avx | FileCheck %s -check-prefixes=AVX,AVX1
5 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mattr=+avx2 | FileCheck %s -check-prefixes=AVX,AVX2
6 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512vl | FileCheck %s -check-prefixes=AVX512,AVX512F
7 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512bw,+avx512vl | FileCheck %s -check-prefixes=AVX512,AVX512BW
9 ; Verify the cost of vector select instructions.
11 define i32 @test_select() {
12 ; SSE-LABEL: 'test_select'
13 ; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
14 ; 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
15 ; 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
16 ; 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
17 ; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
18 ; 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
19 ; 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
20 ; 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
21 ; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
22 ; 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
23 ; 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
24 ; 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
25 ; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
26 ; 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
27 ; 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
28 ; 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
29 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
31 ; AVX1-LABEL: 'test_select'
32 ; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
33 ; 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
34 ; 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
35 ; 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
36 ; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
37 ; 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
38 ; 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
39 ; 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
40 ; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
41 ; 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
42 ; 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
43 ; 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
44 ; AVX1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
45 ; 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
46 ; 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
47 ; 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
48 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
50 ; AVX2-LABEL: 'test_select'
51 ; AVX2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
52 ; 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
53 ; 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
54 ; 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
55 ; AVX2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
56 ; 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
57 ; 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
58 ; 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
59 ; AVX2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
60 ; 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
61 ; 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
62 ; 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
63 ; AVX2-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
64 ; 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
65 ; 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
66 ; 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
67 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
69 ; AVX512F-LABEL: 'test_select'
70 ; AVX512F-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
71 ; 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
72 ; 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
73 ; 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
74 ; AVX512F-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
75 ; 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
76 ; 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
77 ; 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
78 ; AVX512F-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
79 ; 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
80 ; 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
81 ; 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
82 ; AVX512F-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
83 ; 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
84 ; 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
85 ; 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
86 ; AVX512F-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
88 ; AVX512BW-LABEL: 'test_select'
89 ; AVX512BW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I64 = select i1 undef, i64 undef, i64 undef
90 ; 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
91 ; 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
92 ; 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
93 ; AVX512BW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I32 = select i1 undef, i32 undef, i32 undef
94 ; 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
95 ; 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
96 ; 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
97 ; AVX512BW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I16 = select i1 undef, i16 undef, i16 undef
98 ; 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
99 ; 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
100 ; 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
101 ; AVX512BW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = select i1 undef, i8 undef, i8 undef
102 ; 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
103 ; 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
104 ; 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
105 ; AVX512BW-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
107 %I64 = select i1 undef, i64 undef, i64 undef
108 %V2I64 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
109 %V4I64 = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
110 %V8I64 = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
112 %I32 = select i1 undef, i32 undef, i32 undef
113 %V4I32 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
114 %V8I32 = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
115 %V16I32 = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
117 %I16 = select i1 undef, i16 undef, i16 undef
118 %V8I16 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
119 %V16I16 = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
120 %V32I16 = select <32 x i1> undef, <32 x i16> undef, <32 x i16> undef
122 %I8 = select i1 undef, i8 undef, i8 undef
123 %V16I8 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
124 %V32I8 = select <32 x i1> undef, <32 x i8> undef, <32 x i8> undef
125 %V64I8 = select <64 x i1> undef, <64 x i8> undef, <64 x i8> undef
130 define i32 @test_select_fp() {
131 ; SSE-LABEL: 'test_select_fp'
132 ; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
133 ; 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
134 ; 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
135 ; 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
136 ; SSE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
137 ; 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
138 ; 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
139 ; 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
140 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
142 ; AVX1-LABEL: 'test_select_fp'
143 ; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
144 ; 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
145 ; 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
146 ; 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
147 ; AVX1-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
148 ; 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
149 ; 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
150 ; 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
151 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
153 ; AVX2-LABEL: 'test_select_fp'
154 ; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F64 = select i1 undef, double undef, double undef
155 ; 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
156 ; 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
157 ; 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
158 ; AVX2-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %F32 = select i1 undef, float undef, float undef
159 ; 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
160 ; 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
161 ; 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
162 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
164 ; AVX512-LABEL: 'test_select_fp'
165 ; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F64 = select i1 undef, double undef, double undef
166 ; 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
167 ; 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
168 ; 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
169 ; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F32 = select i1 undef, float undef, float undef
170 ; 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
171 ; 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
172 ; 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
173 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
175 %F64 = select i1 undef, double undef, double undef
176 %V2F64 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
177 %V4F64 = select <4 x i1> undef, <4 x double> undef, <4 x double> undef
178 %V8F64 = select <8 x i1> undef, <8 x double> undef, <8 x double> undef
180 %F32 = select i1 undef, float undef, float undef
181 %V4F32 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
182 %V8F32 = select <8 x i1> undef, <8 x float> undef, <8 x float> undef
183 %V16F32 = select <16 x i1> undef, <16 x float> undef, <16 x float> undef
188 ; Immediate blend instructions for <2 x double> and <4 x float> added at SSE41.
189 ; Integers of the same size should also use those instructions.
191 define <2 x i64> @test_2i64(<2 x i64> %a, <2 x i64> %b) {
192 ; SSE-LABEL: 'test_2i64'
193 ; 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
194 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
196 ; AVX-LABEL: 'test_2i64'
197 ; 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
198 ; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
200 ; AVX512-LABEL: 'test_2i64'
201 ; 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
202 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %sel
204 %sel = select <2 x i1> <i1 true, i1 false>, <2 x i64> %a, <2 x i64> %b
208 define <2 x double> @test_2double(<2 x double> %a, <2 x double> %b) {
209 ; SSE-LABEL: 'test_2double'
210 ; 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
211 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
213 ; AVX-LABEL: 'test_2double'
214 ; 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
215 ; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
217 ; AVX512-LABEL: 'test_2double'
218 ; 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
219 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x double> %sel
221 %sel = select <2 x i1> <i1 true, i1 false>, <2 x double> %a, <2 x double> %b
222 ret <2 x double> %sel
225 define <4 x i32> @test_4i32(<4 x i32> %a, <4 x i32> %b) {
226 ; SSE-LABEL: 'test_4i32'
227 ; 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
228 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
230 ; AVX-LABEL: 'test_4i32'
231 ; 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
232 ; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
234 ; AVX512-LABEL: 'test_4i32'
235 ; 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
236 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %sel
238 %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x i32> %a, <4 x i32> %b
242 define <4 x float> @test_4float(<4 x float> %a, <4 x float> %b) {
243 ; SSE-LABEL: 'test_4float'
244 ; 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
245 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
247 ; AVX-LABEL: 'test_4float'
248 ; 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
249 ; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
251 ; AVX512-LABEL: 'test_4float'
252 ; 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
253 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x float> %sel
255 %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 true>, <4 x float> %a, <4 x float> %b
259 define <16 x i8> @test_16i8(<16 x i8> %a, <16 x i8> %b) {
260 ; SSE-LABEL: 'test_16i8'
261 ; 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
262 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
264 ; AVX-LABEL: 'test_16i8'
265 ; 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
266 ; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
268 ; AVX512-LABEL: 'test_16i8'
269 ; 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
270 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %sel
272 %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
276 ; Immediate blend instructions for <4 x double> and <8 x float> added at AVX.
277 ; Integers of the same size should also use those instructions.
279 define <4 x i64> @test_4i64(<4 x i64> %a, <4 x i64> %b) {
280 ; SSE-LABEL: 'test_4i64'
281 ; 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
282 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
284 ; AVX1-LABEL: 'test_4i64'
285 ; 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
286 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
288 ; AVX2-LABEL: 'test_4i64'
289 ; 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
290 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
292 ; AVX512-LABEL: 'test_4i64'
293 ; 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
294 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %sel
296 %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i64> %a, <4 x i64> %b
300 define <4 x double> @test_4double(<4 x double> %a, <4 x double> %b) {
301 ; SSE-LABEL: 'test_4double'
302 ; 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
303 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
305 ; AVX1-LABEL: 'test_4double'
306 ; 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
307 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
309 ; AVX2-LABEL: 'test_4double'
310 ; 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
311 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
313 ; AVX512-LABEL: 'test_4double'
314 ; 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
315 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x double> %sel
317 %sel = select <4 x i1> <i1 true, i1 false, i1 true, i1 false>, <4 x double> %a, <4 x double> %b
318 ret <4 x double> %sel
321 define <8 x i32> @test_8i32(<8 x i32> %a, <8 x i32> %b) {
322 ; SSE-LABEL: 'test_8i32'
323 ; 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
324 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
326 ; AVX1-LABEL: 'test_8i32'
327 ; 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
328 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
330 ; AVX2-LABEL: 'test_8i32'
331 ; 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
332 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
334 ; AVX512-LABEL: 'test_8i32'
335 ; 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
336 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %sel
338 %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
342 define <8 x float> @test_8float(<8 x float> %a, <8 x float> %b) {
343 ; SSE-LABEL: 'test_8float'
344 ; 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
345 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
347 ; AVX1-LABEL: 'test_8float'
348 ; 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
349 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
351 ; AVX2-LABEL: 'test_8float'
352 ; 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
353 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
355 ; AVX512-LABEL: 'test_8float'
356 ; 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
357 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %sel
359 %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
363 define <16 x i16> @test_16i16(<16 x i16> %a, <16 x i16> %b) {
364 ; SSE-LABEL: 'test_16i16'
365 ; 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
366 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
368 ; AVX1-LABEL: 'test_16i16'
369 ; 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
370 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
372 ; AVX2-LABEL: 'test_16i16'
373 ; 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
374 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
376 ; AVX512-LABEL: 'test_16i16'
377 ; 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
378 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %sel
380 %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
384 define <32 x i8> @test_32i8(<32 x i8> %a, <32 x i8> %b) {
385 ; SSE-LABEL: 'test_32i8'
386 ; 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
387 ; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
389 ; AVX1-LABEL: 'test_32i8'
390 ; 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
391 ; AVX1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
393 ; AVX2-LABEL: 'test_32i8'
394 ; 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
395 ; AVX2-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
397 ; AVX512-LABEL: 'test_32i8'
398 ; 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
399 ; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %sel
401 %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