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