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