xref: /llvm-project/llvm/test/CodeGen/PowerPC/scalar_cmp.ll (revision b922a3621116b404d868af8b74cab25ab78555be)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names --enable-unsafe-fp-math \
3; RUN:   -verify-machineinstrs --enable-no-signed-zeros-fp-math \
4; RUN:   --enable-no-nans-fp-math --enable-no-infs-fp-math \
5; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
6; RUN:   --check-prefix=FAST-P8
7; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names --enable-unsafe-fp-math \
8; RUN:   -verify-machineinstrs --enable-no-signed-zeros-fp-math \
9; RUN:   --enable-no-nans-fp-math --enable-no-infs-fp-math \
10; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
11; RUN:   --check-prefix=FAST-P9
12; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -verify-machineinstrs \
13; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
14; RUN:   --check-prefix=NO-FAST-P8
15; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names -verify-machineinstrs \
16; RUN:   -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
17; RUN:   --check-prefix=NO-FAST-P9
18
19; Test oeq
20define float @select_oeq_float(float %a, float %b, float %c, float %d) {
21; FAST-P8-LABEL: select_oeq_float:
22; FAST-P8:       # %bb.0: # %entry
23; FAST-P8-NEXT:    xssubsp f0, f2, f1
24; FAST-P8-NEXT:    xssubsp f1, f1, f2
25; FAST-P8-NEXT:    fsel f1, f1, f3, f4
26; FAST-P8-NEXT:    fsel f1, f0, f1, f4
27; FAST-P8-NEXT:    blr
28;
29; FAST-P9-LABEL: select_oeq_float:
30; FAST-P9:       # %bb.0: # %entry
31; FAST-P9-NEXT:    xssubsp f0, f2, f1
32; FAST-P9-NEXT:    xssubsp f1, f1, f2
33; FAST-P9-NEXT:    fsel f1, f1, f3, f4
34; FAST-P9-NEXT:    fsel f1, f0, f1, f4
35; FAST-P9-NEXT:    blr
36;
37; NO-FAST-P8-LABEL: select_oeq_float:
38; NO-FAST-P8:       # %bb.0: # %entry
39; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
40; NO-FAST-P8-NEXT:    beq cr0, .LBB0_2
41; NO-FAST-P8-NEXT:  # %bb.1: # %entry
42; NO-FAST-P8-NEXT:    fmr f3, f4
43; NO-FAST-P8-NEXT:  .LBB0_2: # %entry
44; NO-FAST-P8-NEXT:    fmr f1, f3
45; NO-FAST-P8-NEXT:    blr
46;
47; NO-FAST-P9-LABEL: select_oeq_float:
48; NO-FAST-P9:       # %bb.0: # %entry
49; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
50; NO-FAST-P9-NEXT:    beq cr0, .LBB0_2
51; NO-FAST-P9-NEXT:  # %bb.1: # %entry
52; NO-FAST-P9-NEXT:    fmr f3, f4
53; NO-FAST-P9-NEXT:  .LBB0_2: # %entry
54; NO-FAST-P9-NEXT:    fmr f1, f3
55; NO-FAST-P9-NEXT:    blr
56entry:
57  %cmp = fcmp oeq float %a, %b
58  %cond = select i1 %cmp, float %c, float %d
59  ret float %cond
60}
61
62define double @select_oeq_double(double %a, double %b, double %c, double %d) {
63; FAST-P8-LABEL: select_oeq_double:
64; FAST-P8:       # %bb.0: # %entry
65; FAST-P8-NEXT:    xssubdp f0, f1, f2
66; FAST-P8-NEXT:    fsel f1, f0, f3, f4
67; FAST-P8-NEXT:    xsnegdp f0, f0
68; FAST-P8-NEXT:    fsel f1, f0, f1, f4
69; FAST-P8-NEXT:    blr
70;
71; FAST-P9-LABEL: select_oeq_double:
72; FAST-P9:       # %bb.0: # %entry
73; FAST-P9-NEXT:    xssubdp f0, f1, f2
74; FAST-P9-NEXT:    fsel f1, f0, f3, f4
75; FAST-P9-NEXT:    xsnegdp f0, f0
76; FAST-P9-NEXT:    fsel f1, f0, f1, f4
77; FAST-P9-NEXT:    blr
78;
79; NO-FAST-P8-LABEL: select_oeq_double:
80; NO-FAST-P8:       # %bb.0: # %entry
81; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f2
82; NO-FAST-P8-NEXT:    beq cr0, .LBB1_2
83; NO-FAST-P8-NEXT:  # %bb.1: # %entry
84; NO-FAST-P8-NEXT:    fmr f3, f4
85; NO-FAST-P8-NEXT:  .LBB1_2: # %entry
86; NO-FAST-P8-NEXT:    fmr f1, f3
87; NO-FAST-P8-NEXT:    blr
88;
89; NO-FAST-P9-LABEL: select_oeq_double:
90; NO-FAST-P9:       # %bb.0: # %entry
91; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f2
92; NO-FAST-P9-NEXT:    beq cr0, .LBB1_2
93; NO-FAST-P9-NEXT:  # %bb.1: # %entry
94; NO-FAST-P9-NEXT:    fmr f3, f4
95; NO-FAST-P9-NEXT:  .LBB1_2: # %entry
96; NO-FAST-P9-NEXT:    fmr f1, f3
97; NO-FAST-P9-NEXT:    blr
98entry:
99  %cmp = fcmp oeq double %a, %b
100  %cond = select i1 %cmp, double %c, double %d
101  ret double %cond
102}
103
104define float @select_fast_oeq_float(float %a, float %b, float %c, float %d) {
105; FAST-P8-LABEL: select_fast_oeq_float:
106; FAST-P8:       # %bb.0: # %entry
107; FAST-P8-NEXT:    xssubsp f0, f2, f1
108; FAST-P8-NEXT:    xssubsp f1, f1, f2
109; FAST-P8-NEXT:    fsel f1, f1, f3, f4
110; FAST-P8-NEXT:    fsel f1, f0, f1, f4
111; FAST-P8-NEXT:    blr
112;
113; FAST-P9-LABEL: select_fast_oeq_float:
114; FAST-P9:       # %bb.0: # %entry
115; FAST-P9-NEXT:    xssubsp f0, f2, f1
116; FAST-P9-NEXT:    xssubsp f1, f1, f2
117; FAST-P9-NEXT:    fsel f1, f1, f3, f4
118; FAST-P9-NEXT:    fsel f1, f0, f1, f4
119; FAST-P9-NEXT:    blr
120;
121; NO-FAST-P8-LABEL: select_fast_oeq_float:
122; NO-FAST-P8:       # %bb.0: # %entry
123; NO-FAST-P8-NEXT:    xssubsp f0, f2, f1
124; NO-FAST-P8-NEXT:    xssubsp f1, f1, f2
125; NO-FAST-P8-NEXT:    fsel f1, f1, f3, f4
126; NO-FAST-P8-NEXT:    fsel f1, f0, f1, f4
127; NO-FAST-P8-NEXT:    blr
128;
129; NO-FAST-P9-LABEL: select_fast_oeq_float:
130; NO-FAST-P9:       # %bb.0: # %entry
131; NO-FAST-P9-NEXT:    xssubsp f0, f2, f1
132; NO-FAST-P9-NEXT:    xssubsp f1, f1, f2
133; NO-FAST-P9-NEXT:    fsel f1, f1, f3, f4
134; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f4
135; NO-FAST-P9-NEXT:    blr
136entry:
137  %cmp = fcmp nnan ninf nsz oeq float %a, %b
138  %cond = select i1 %cmp, float %c, float %d
139  ret float %cond
140}
141
142define double @select_fast_oeq_double(double %a, double %b, double %c, double %d) {
143; FAST-P8-LABEL: select_fast_oeq_double:
144; FAST-P8:       # %bb.0: # %entry
145; FAST-P8-NEXT:    xssubdp f0, f1, f2
146; FAST-P8-NEXT:    fsel f1, f0, f3, f4
147; FAST-P8-NEXT:    xsnegdp f0, f0
148; FAST-P8-NEXT:    fsel f1, f0, f1, f4
149; FAST-P8-NEXT:    blr
150;
151; FAST-P9-LABEL: select_fast_oeq_double:
152; FAST-P9:       # %bb.0: # %entry
153; FAST-P9-NEXT:    xssubdp f0, f1, f2
154; FAST-P9-NEXT:    fsel f1, f0, f3, f4
155; FAST-P9-NEXT:    xsnegdp f0, f0
156; FAST-P9-NEXT:    fsel f1, f0, f1, f4
157; FAST-P9-NEXT:    blr
158;
159; NO-FAST-P8-LABEL: select_fast_oeq_double:
160; NO-FAST-P8:       # %bb.0: # %entry
161; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
162; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
163; NO-FAST-P8-NEXT:    xsnegdp f0, f0
164; NO-FAST-P8-NEXT:    fsel f1, f0, f1, f4
165; NO-FAST-P8-NEXT:    blr
166;
167; NO-FAST-P9-LABEL: select_fast_oeq_double:
168; NO-FAST-P9:       # %bb.0: # %entry
169; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
170; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
171; NO-FAST-P9-NEXT:    xsnegdp f0, f0
172; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f4
173; NO-FAST-P9-NEXT:    blr
174entry:
175  %cmp = fcmp nnan ninf nsz oeq double %a, %b
176  %cond = select i1 %cmp, double %c, double %d
177  ret double %cond
178}
179
180
181; Test one
182define float @select_one_float(float %a, float %b, float %c, float %d) {
183; FAST-P8-LABEL: select_one_float:
184; FAST-P8:       # %bb.0: # %entry
185; FAST-P8-NEXT:    xssubsp f0, f2, f1
186; FAST-P8-NEXT:    xssubsp f1, f1, f2
187; FAST-P8-NEXT:    fsel f1, f1, f4, f3
188; FAST-P8-NEXT:    fsel f1, f0, f1, f3
189; FAST-P8-NEXT:    blr
190;
191; FAST-P9-LABEL: select_one_float:
192; FAST-P9:       # %bb.0: # %entry
193; FAST-P9-NEXT:    xssubsp f0, f2, f1
194; FAST-P9-NEXT:    xssubsp f1, f1, f2
195; FAST-P9-NEXT:    fsel f1, f1, f4, f3
196; FAST-P9-NEXT:    fsel f1, f0, f1, f3
197; FAST-P9-NEXT:    blr
198;
199; NO-FAST-P8-LABEL: select_one_float:
200; NO-FAST-P8:       # %bb.0: # %entry
201; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
202; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, eq
203; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB4_2
204; NO-FAST-P8-NEXT:  # %bb.1: # %entry
205; NO-FAST-P8-NEXT:    fmr f3, f4
206; NO-FAST-P8-NEXT:  .LBB4_2: # %entry
207; NO-FAST-P8-NEXT:    fmr f1, f3
208; NO-FAST-P8-NEXT:    blr
209;
210; NO-FAST-P9-LABEL: select_one_float:
211; NO-FAST-P9:       # %bb.0: # %entry
212; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
213; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, eq
214; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB4_2
215; NO-FAST-P9-NEXT:  # %bb.1: # %entry
216; NO-FAST-P9-NEXT:    fmr f3, f4
217; NO-FAST-P9-NEXT:  .LBB4_2: # %entry
218; NO-FAST-P9-NEXT:    fmr f1, f3
219; NO-FAST-P9-NEXT:    blr
220entry:
221  %cmp = fcmp one float %a, %b
222  %cond = select i1 %cmp, float %c, float %d
223  ret float %cond
224}
225
226define double @select_one_double(double %a, double %b, double %c, double %d) {
227; FAST-P8-LABEL: select_one_double:
228; FAST-P8:       # %bb.0: # %entry
229; FAST-P8-NEXT:    xssubdp f0, f1, f2
230; FAST-P8-NEXT:    fsel f1, f0, f4, f3
231; FAST-P8-NEXT:    xsnegdp f0, f0
232; FAST-P8-NEXT:    fsel f1, f0, f1, f3
233; FAST-P8-NEXT:    blr
234;
235; FAST-P9-LABEL: select_one_double:
236; FAST-P9:       # %bb.0: # %entry
237; FAST-P9-NEXT:    xssubdp f0, f1, f2
238; FAST-P9-NEXT:    fsel f1, f0, f4, f3
239; FAST-P9-NEXT:    xsnegdp f0, f0
240; FAST-P9-NEXT:    fsel f1, f0, f1, f3
241; FAST-P9-NEXT:    blr
242;
243; NO-FAST-P8-LABEL: select_one_double:
244; NO-FAST-P8:       # %bb.0: # %entry
245; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
246; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, eq
247; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB5_2
248; NO-FAST-P8-NEXT:  # %bb.1: # %entry
249; NO-FAST-P8-NEXT:    fmr f3, f4
250; NO-FAST-P8-NEXT:  .LBB5_2: # %entry
251; NO-FAST-P8-NEXT:    fmr f1, f3
252; NO-FAST-P8-NEXT:    blr
253;
254; NO-FAST-P9-LABEL: select_one_double:
255; NO-FAST-P9:       # %bb.0: # %entry
256; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
257; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, eq
258; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB5_2
259; NO-FAST-P9-NEXT:  # %bb.1: # %entry
260; NO-FAST-P9-NEXT:    fmr f3, f4
261; NO-FAST-P9-NEXT:  .LBB5_2: # %entry
262; NO-FAST-P9-NEXT:    fmr f1, f3
263; NO-FAST-P9-NEXT:    blr
264entry:
265  %cmp = fcmp one double %a, %b
266  %cond = select i1 %cmp, double %c, double %d
267  ret double %cond
268}
269
270define float @select_fast_one_float(float %a, float %b, float %c, float %d) {
271; FAST-P8-LABEL: select_fast_one_float:
272; FAST-P8:       # %bb.0: # %entry
273; FAST-P8-NEXT:    xssubsp f0, f2, f1
274; FAST-P8-NEXT:    xssubsp f1, f1, f2
275; FAST-P8-NEXT:    fsel f1, f1, f4, f3
276; FAST-P8-NEXT:    fsel f1, f0, f1, f3
277; FAST-P8-NEXT:    blr
278;
279; FAST-P9-LABEL: select_fast_one_float:
280; FAST-P9:       # %bb.0: # %entry
281; FAST-P9-NEXT:    xssubsp f0, f2, f1
282; FAST-P9-NEXT:    xssubsp f1, f1, f2
283; FAST-P9-NEXT:    fsel f1, f1, f4, f3
284; FAST-P9-NEXT:    fsel f1, f0, f1, f3
285; FAST-P9-NEXT:    blr
286;
287; NO-FAST-P8-LABEL: select_fast_one_float:
288; NO-FAST-P8:       # %bb.0: # %entry
289; NO-FAST-P8-NEXT:    xssubsp f0, f2, f1
290; NO-FAST-P8-NEXT:    xssubsp f1, f1, f2
291; NO-FAST-P8-NEXT:    fsel f1, f1, f4, f3
292; NO-FAST-P8-NEXT:    fsel f1, f0, f1, f3
293; NO-FAST-P8-NEXT:    blr
294;
295; NO-FAST-P9-LABEL: select_fast_one_float:
296; NO-FAST-P9:       # %bb.0: # %entry
297; NO-FAST-P9-NEXT:    xssubsp f0, f2, f1
298; NO-FAST-P9-NEXT:    xssubsp f1, f1, f2
299; NO-FAST-P9-NEXT:    fsel f1, f1, f4, f3
300; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f3
301; NO-FAST-P9-NEXT:    blr
302entry:
303  %cmp = fcmp nnan ninf nsz one float %a, %b
304  %cond = select i1 %cmp, float %c, float %d
305  ret float %cond
306}
307
308define double @select_fast_one_double(double %a, double %b, double %c, double %d) {
309; FAST-P8-LABEL: select_fast_one_double:
310; FAST-P8:       # %bb.0: # %entry
311; FAST-P8-NEXT:    xssubdp f0, f1, f2
312; FAST-P8-NEXT:    fsel f1, f0, f4, f3
313; FAST-P8-NEXT:    xsnegdp f0, f0
314; FAST-P8-NEXT:    fsel f1, f0, f1, f3
315; FAST-P8-NEXT:    blr
316;
317; FAST-P9-LABEL: select_fast_one_double:
318; FAST-P9:       # %bb.0: # %entry
319; FAST-P9-NEXT:    xssubdp f0, f1, f2
320; FAST-P9-NEXT:    fsel f1, f0, f4, f3
321; FAST-P9-NEXT:    xsnegdp f0, f0
322; FAST-P9-NEXT:    fsel f1, f0, f1, f3
323; FAST-P9-NEXT:    blr
324;
325; NO-FAST-P8-LABEL: select_fast_one_double:
326; NO-FAST-P8:       # %bb.0: # %entry
327; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
328; NO-FAST-P8-NEXT:    fsel f1, f0, f4, f3
329; NO-FAST-P8-NEXT:    xsnegdp f0, f0
330; NO-FAST-P8-NEXT:    fsel f1, f0, f1, f3
331; NO-FAST-P8-NEXT:    blr
332;
333; NO-FAST-P9-LABEL: select_fast_one_double:
334; NO-FAST-P9:       # %bb.0: # %entry
335; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
336; NO-FAST-P9-NEXT:    fsel f1, f0, f4, f3
337; NO-FAST-P9-NEXT:    xsnegdp f0, f0
338; NO-FAST-P9-NEXT:    fsel f1, f0, f1, f3
339; NO-FAST-P9-NEXT:    blr
340entry:
341  %cmp = fcmp nnan ninf nsz one double %a, %b
342  %cond = select i1 %cmp, double %c, double %d
343  ret double %cond
344}
345
346
347; Test oge
348define float @select_oge_float(float %a, float %b, float %c, float %d) {
349; FAST-P8-LABEL: select_oge_float:
350; FAST-P8:       # %bb.0: # %entry
351; FAST-P8-NEXT:    xssubsp f0, f1, f2
352; FAST-P8-NEXT:    fsel f1, f0, f3, f4
353; FAST-P8-NEXT:    blr
354;
355; FAST-P9-LABEL: select_oge_float:
356; FAST-P9:       # %bb.0: # %entry
357; FAST-P9-NEXT:    xssubsp f0, f1, f2
358; FAST-P9-NEXT:    fsel f1, f0, f3, f4
359; FAST-P9-NEXT:    blr
360;
361; NO-FAST-P8-LABEL: select_oge_float:
362; NO-FAST-P8:       # %bb.0: # %entry
363; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
364; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, lt
365; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB8_2
366; NO-FAST-P8-NEXT:  # %bb.1: # %entry
367; NO-FAST-P8-NEXT:    fmr f3, f4
368; NO-FAST-P8-NEXT:  .LBB8_2: # %entry
369; NO-FAST-P8-NEXT:    fmr f1, f3
370; NO-FAST-P8-NEXT:    blr
371;
372; NO-FAST-P9-LABEL: select_oge_float:
373; NO-FAST-P9:       # %bb.0: # %entry
374; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
375; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, lt
376; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB8_2
377; NO-FAST-P9-NEXT:  # %bb.1: # %entry
378; NO-FAST-P9-NEXT:    fmr f3, f4
379; NO-FAST-P9-NEXT:  .LBB8_2: # %entry
380; NO-FAST-P9-NEXT:    fmr f1, f3
381; NO-FAST-P9-NEXT:    blr
382entry:
383  %cmp = fcmp oge float %a, %b
384  %cond = select i1 %cmp, float %c, float %d
385  ret float %cond
386}
387
388define double @select_oge_double(double %a, double %b, double %c, double %d) {
389; FAST-P8-LABEL: select_oge_double:
390; FAST-P8:       # %bb.0: # %entry
391; FAST-P8-NEXT:    xssubdp f0, f1, f2
392; FAST-P8-NEXT:    fsel f1, f0, f3, f4
393; FAST-P8-NEXT:    blr
394;
395; FAST-P9-LABEL: select_oge_double:
396; FAST-P9:       # %bb.0: # %entry
397; FAST-P9-NEXT:    xssubdp f0, f1, f2
398; FAST-P9-NEXT:    fsel f1, f0, f3, f4
399; FAST-P9-NEXT:    blr
400;
401; NO-FAST-P8-LABEL: select_oge_double:
402; NO-FAST-P8:       # %bb.0: # %entry
403; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
404; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, lt
405; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB9_2
406; NO-FAST-P8-NEXT:  # %bb.1: # %entry
407; NO-FAST-P8-NEXT:    fmr f3, f4
408; NO-FAST-P8-NEXT:  .LBB9_2: # %entry
409; NO-FAST-P8-NEXT:    fmr f1, f3
410; NO-FAST-P8-NEXT:    blr
411;
412; NO-FAST-P9-LABEL: select_oge_double:
413; NO-FAST-P9:       # %bb.0: # %entry
414; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
415; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, lt
416; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB9_2
417; NO-FAST-P9-NEXT:  # %bb.1: # %entry
418; NO-FAST-P9-NEXT:    fmr f3, f4
419; NO-FAST-P9-NEXT:  .LBB9_2: # %entry
420; NO-FAST-P9-NEXT:    fmr f1, f3
421; NO-FAST-P9-NEXT:    blr
422entry:
423  %cmp = fcmp oge double %a, %b
424  %cond = select i1 %cmp, double %c, double %d
425  ret double %cond
426}
427
428define float @select_fast_oge_float(float %a, float %b, float %c, float %d) {
429; FAST-P8-LABEL: select_fast_oge_float:
430; FAST-P8:       # %bb.0: # %entry
431; FAST-P8-NEXT:    xssubsp f0, f1, f2
432; FAST-P8-NEXT:    fsel f1, f0, f3, f4
433; FAST-P8-NEXT:    blr
434;
435; FAST-P9-LABEL: select_fast_oge_float:
436; FAST-P9:       # %bb.0: # %entry
437; FAST-P9-NEXT:    xssubsp f0, f1, f2
438; FAST-P9-NEXT:    fsel f1, f0, f3, f4
439; FAST-P9-NEXT:    blr
440;
441; NO-FAST-P8-LABEL: select_fast_oge_float:
442; NO-FAST-P8:       # %bb.0: # %entry
443; NO-FAST-P8-NEXT:    xssubsp f0, f1, f2
444; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
445; NO-FAST-P8-NEXT:    blr
446;
447; NO-FAST-P9-LABEL: select_fast_oge_float:
448; NO-FAST-P9:       # %bb.0: # %entry
449; NO-FAST-P9-NEXT:    xssubsp f0, f1, f2
450; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
451; NO-FAST-P9-NEXT:    blr
452entry:
453  %cmp = fcmp nnan ninf nsz oge float %a, %b
454  %cond = select i1 %cmp, float %c, float %d
455  ret float %cond
456}
457
458define double @select_fast_oge_double(double %a, double %b, double %c, double %d) {
459; FAST-P8-LABEL: select_fast_oge_double:
460; FAST-P8:       # %bb.0: # %entry
461; FAST-P8-NEXT:    xssubdp f0, f1, f2
462; FAST-P8-NEXT:    fsel f1, f0, f3, f4
463; FAST-P8-NEXT:    blr
464;
465; FAST-P9-LABEL: select_fast_oge_double:
466; FAST-P9:       # %bb.0: # %entry
467; FAST-P9-NEXT:    xssubdp f0, f1, f2
468; FAST-P9-NEXT:    fsel f1, f0, f3, f4
469; FAST-P9-NEXT:    blr
470;
471; NO-FAST-P8-LABEL: select_fast_oge_double:
472; NO-FAST-P8:       # %bb.0: # %entry
473; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
474; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
475; NO-FAST-P8-NEXT:    blr
476;
477; NO-FAST-P9-LABEL: select_fast_oge_double:
478; NO-FAST-P9:       # %bb.0: # %entry
479; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
480; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
481; NO-FAST-P9-NEXT:    blr
482entry:
483  %cmp = fcmp nnan ninf nsz oge double %a, %b
484  %cond = select i1 %cmp, double %c, double %d
485  ret double %cond
486}
487
488
489; Test olt
490define float @select_olt_float(float %a, float %b, float %c, float %d) {
491; FAST-P8-LABEL: select_olt_float:
492; FAST-P8:       # %bb.0: # %entry
493; FAST-P8-NEXT:    xssubsp f0, f1, f2
494; FAST-P8-NEXT:    fsel f1, f0, f4, f3
495; FAST-P8-NEXT:    blr
496;
497; FAST-P9-LABEL: select_olt_float:
498; FAST-P9:       # %bb.0: # %entry
499; FAST-P9-NEXT:    xssubsp f0, f1, f2
500; FAST-P9-NEXT:    fsel f1, f0, f4, f3
501; FAST-P9-NEXT:    blr
502;
503; NO-FAST-P8-LABEL: select_olt_float:
504; NO-FAST-P8:       # %bb.0: # %entry
505; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
506; NO-FAST-P8-NEXT:    blt cr0, .LBB12_2
507; NO-FAST-P8-NEXT:  # %bb.1: # %entry
508; NO-FAST-P8-NEXT:    fmr f3, f4
509; NO-FAST-P8-NEXT:  .LBB12_2: # %entry
510; NO-FAST-P8-NEXT:    fmr f1, f3
511; NO-FAST-P8-NEXT:    blr
512;
513; NO-FAST-P9-LABEL: select_olt_float:
514; NO-FAST-P9:       # %bb.0: # %entry
515; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
516; NO-FAST-P9-NEXT:    blt cr0, .LBB12_2
517; NO-FAST-P9-NEXT:  # %bb.1: # %entry
518; NO-FAST-P9-NEXT:    fmr f3, f4
519; NO-FAST-P9-NEXT:  .LBB12_2: # %entry
520; NO-FAST-P9-NEXT:    fmr f1, f3
521; NO-FAST-P9-NEXT:    blr
522entry:
523  %cmp = fcmp olt float %a, %b
524  %cond = select i1 %cmp, float %c, float %d
525  ret float %cond
526}
527
528define double @select_olt_double(double %a, double %b, double %c, double %d) {
529; FAST-P8-LABEL: select_olt_double:
530; FAST-P8:       # %bb.0: # %entry
531; FAST-P8-NEXT:    xssubdp f0, f1, f2
532; FAST-P8-NEXT:    fsel f1, f0, f4, f3
533; FAST-P8-NEXT:    blr
534;
535; FAST-P9-LABEL: select_olt_double:
536; FAST-P9:       # %bb.0: # %entry
537; FAST-P9-NEXT:    xssubdp f0, f1, f2
538; FAST-P9-NEXT:    fsel f1, f0, f4, f3
539; FAST-P9-NEXT:    blr
540;
541; NO-FAST-P8-LABEL: select_olt_double:
542; NO-FAST-P8:       # %bb.0: # %entry
543; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f2
544; NO-FAST-P8-NEXT:    blt cr0, .LBB13_2
545; NO-FAST-P8-NEXT:  # %bb.1: # %entry
546; NO-FAST-P8-NEXT:    fmr f3, f4
547; NO-FAST-P8-NEXT:  .LBB13_2: # %entry
548; NO-FAST-P8-NEXT:    fmr f1, f3
549; NO-FAST-P8-NEXT:    blr
550;
551; NO-FAST-P9-LABEL: select_olt_double:
552; NO-FAST-P9:       # %bb.0: # %entry
553; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f2
554; NO-FAST-P9-NEXT:    blt cr0, .LBB13_2
555; NO-FAST-P9-NEXT:  # %bb.1: # %entry
556; NO-FAST-P9-NEXT:    fmr f3, f4
557; NO-FAST-P9-NEXT:  .LBB13_2: # %entry
558; NO-FAST-P9-NEXT:    fmr f1, f3
559; NO-FAST-P9-NEXT:    blr
560entry:
561  %cmp = fcmp olt double %a, %b
562  %cond = select i1 %cmp, double %c, double %d
563  ret double %cond
564}
565
566define float @select_fast_olt_float(float %a, float %b, float %c, float %d) {
567; FAST-P8-LABEL: select_fast_olt_float:
568; FAST-P8:       # %bb.0: # %entry
569; FAST-P8-NEXT:    xssubsp f0, f1, f2
570; FAST-P8-NEXT:    fsel f1, f0, f4, f3
571; FAST-P8-NEXT:    blr
572;
573; FAST-P9-LABEL: select_fast_olt_float:
574; FAST-P9:       # %bb.0: # %entry
575; FAST-P9-NEXT:    xssubsp f0, f1, f2
576; FAST-P9-NEXT:    fsel f1, f0, f4, f3
577; FAST-P9-NEXT:    blr
578;
579; NO-FAST-P8-LABEL: select_fast_olt_float:
580; NO-FAST-P8:       # %bb.0: # %entry
581; NO-FAST-P8-NEXT:    xssubsp f0, f1, f2
582; NO-FAST-P8-NEXT:    fsel f1, f0, f4, f3
583; NO-FAST-P8-NEXT:    blr
584;
585; NO-FAST-P9-LABEL: select_fast_olt_float:
586; NO-FAST-P9:       # %bb.0: # %entry
587; NO-FAST-P9-NEXT:    xssubsp f0, f1, f2
588; NO-FAST-P9-NEXT:    fsel f1, f0, f4, f3
589; NO-FAST-P9-NEXT:    blr
590entry:
591  %cmp = fcmp ninf nnan nsz olt float %a, %b
592  %cond = select i1 %cmp, float %c, float %d
593  ret float %cond
594}
595
596define double @select_fast_olt_double(double %a, double %b, double %c, double %d) {
597; FAST-P8-LABEL: select_fast_olt_double:
598; FAST-P8:       # %bb.0: # %entry
599; FAST-P8-NEXT:    xssubdp f0, f1, f2
600; FAST-P8-NEXT:    fsel f1, f0, f4, f3
601; FAST-P8-NEXT:    blr
602;
603; FAST-P9-LABEL: select_fast_olt_double:
604; FAST-P9:       # %bb.0: # %entry
605; FAST-P9-NEXT:    xssubdp f0, f1, f2
606; FAST-P9-NEXT:    fsel f1, f0, f4, f3
607; FAST-P9-NEXT:    blr
608;
609; NO-FAST-P8-LABEL: select_fast_olt_double:
610; NO-FAST-P8:       # %bb.0: # %entry
611; NO-FAST-P8-NEXT:    xssubdp f0, f1, f2
612; NO-FAST-P8-NEXT:    fsel f1, f0, f4, f3
613; NO-FAST-P8-NEXT:    blr
614;
615; NO-FAST-P9-LABEL: select_fast_olt_double:
616; NO-FAST-P9:       # %bb.0: # %entry
617; NO-FAST-P9-NEXT:    xssubdp f0, f1, f2
618; NO-FAST-P9-NEXT:    fsel f1, f0, f4, f3
619; NO-FAST-P9-NEXT:    blr
620entry:
621  %cmp = fcmp nnan ninf nsz olt double %a, %b
622  %cond = select i1 %cmp, double %c, double %d
623  ret double %cond
624}
625
626
627; Test ogt
628define float @select_ogt_float(float %a, float %b, float %c, float %d) {
629; FAST-P8-LABEL: select_ogt_float:
630; FAST-P8:       # %bb.0: # %entry
631; FAST-P8-NEXT:    xssubsp f0, f2, f1
632; FAST-P8-NEXT:    fsel f1, f0, f4, f3
633; FAST-P8-NEXT:    blr
634;
635; FAST-P9-LABEL: select_ogt_float:
636; FAST-P9:       # %bb.0: # %entry
637; FAST-P9-NEXT:    xssubsp f0, f2, f1
638; FAST-P9-NEXT:    fsel f1, f0, f4, f3
639; FAST-P9-NEXT:    blr
640;
641; NO-FAST-P8-LABEL: select_ogt_float:
642; NO-FAST-P8:       # %bb.0: # %entry
643; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
644; NO-FAST-P8-NEXT:    bgt cr0, .LBB16_2
645; NO-FAST-P8-NEXT:  # %bb.1: # %entry
646; NO-FAST-P8-NEXT:    fmr f3, f4
647; NO-FAST-P8-NEXT:  .LBB16_2: # %entry
648; NO-FAST-P8-NEXT:    fmr f1, f3
649; NO-FAST-P8-NEXT:    blr
650;
651; NO-FAST-P9-LABEL: select_ogt_float:
652; NO-FAST-P9:       # %bb.0: # %entry
653; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
654; NO-FAST-P9-NEXT:    bgt cr0, .LBB16_2
655; NO-FAST-P9-NEXT:  # %bb.1: # %entry
656; NO-FAST-P9-NEXT:    fmr f3, f4
657; NO-FAST-P9-NEXT:  .LBB16_2: # %entry
658; NO-FAST-P9-NEXT:    fmr f1, f3
659; NO-FAST-P9-NEXT:    blr
660entry:
661  %cmp = fcmp ogt float %a, %b
662  %cond = select i1 %cmp, float %c, float %d
663  ret float %cond
664}
665
666define double @select_ogt_double(double %a, double %b, double %c, double %d) {
667; FAST-P8-LABEL: select_ogt_double:
668; FAST-P8:       # %bb.0: # %entry
669; FAST-P8-NEXT:    xssubdp f0, f2, f1
670; FAST-P8-NEXT:    fsel f1, f0, f4, f3
671; FAST-P8-NEXT:    blr
672;
673; FAST-P9-LABEL: select_ogt_double:
674; FAST-P9:       # %bb.0: # %entry
675; FAST-P9-NEXT:    xssubdp f0, f2, f1
676; FAST-P9-NEXT:    fsel f1, f0, f4, f3
677; FAST-P9-NEXT:    blr
678;
679; NO-FAST-P8-LABEL: select_ogt_double:
680; NO-FAST-P8:       # %bb.0: # %entry
681; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f2
682; NO-FAST-P8-NEXT:    bgt cr0, .LBB17_2
683; NO-FAST-P8-NEXT:  # %bb.1: # %entry
684; NO-FAST-P8-NEXT:    fmr f3, f4
685; NO-FAST-P8-NEXT:  .LBB17_2: # %entry
686; NO-FAST-P8-NEXT:    fmr f1, f3
687; NO-FAST-P8-NEXT:    blr
688;
689; NO-FAST-P9-LABEL: select_ogt_double:
690; NO-FAST-P9:       # %bb.0: # %entry
691; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f2
692; NO-FAST-P9-NEXT:    bgt cr0, .LBB17_2
693; NO-FAST-P9-NEXT:  # %bb.1: # %entry
694; NO-FAST-P9-NEXT:    fmr f3, f4
695; NO-FAST-P9-NEXT:  .LBB17_2: # %entry
696; NO-FAST-P9-NEXT:    fmr f1, f3
697; NO-FAST-P9-NEXT:    blr
698entry:
699  %cmp = fcmp ogt double %a, %b
700  %cond = select i1 %cmp, double %c, double %d
701  ret double %cond
702}
703
704define float @select_fast_ogt_float(float %a, float %b, float %c, float %d) {
705; FAST-P8-LABEL: select_fast_ogt_float:
706; FAST-P8:       # %bb.0: # %entry
707; FAST-P8-NEXT:    xssubsp f0, f2, f1
708; FAST-P8-NEXT:    fsel f1, f0, f4, f3
709; FAST-P8-NEXT:    blr
710;
711; FAST-P9-LABEL: select_fast_ogt_float:
712; FAST-P9:       # %bb.0: # %entry
713; FAST-P9-NEXT:    xssubsp f0, f2, f1
714; FAST-P9-NEXT:    fsel f1, f0, f4, f3
715; FAST-P9-NEXT:    blr
716;
717; NO-FAST-P8-LABEL: select_fast_ogt_float:
718; NO-FAST-P8:       # %bb.0: # %entry
719; NO-FAST-P8-NEXT:    xssubsp f0, f2, f1
720; NO-FAST-P8-NEXT:    fsel f1, f0, f4, f3
721; NO-FAST-P8-NEXT:    blr
722;
723; NO-FAST-P9-LABEL: select_fast_ogt_float:
724; NO-FAST-P9:       # %bb.0: # %entry
725; NO-FAST-P9-NEXT:    xssubsp f0, f2, f1
726; NO-FAST-P9-NEXT:    fsel f1, f0, f4, f3
727; NO-FAST-P9-NEXT:    blr
728entry:
729  %cmp = fcmp nnan ninf nsz ogt float %a, %b
730  %cond = select i1 %cmp, float %c, float %d
731  ret float %cond
732}
733
734define double @select_fast_ogt_double(double %a, double %b, double %c, double %d) {
735; FAST-P8-LABEL: select_fast_ogt_double:
736; FAST-P8:       # %bb.0: # %entry
737; FAST-P8-NEXT:    xssubdp f0, f2, f1
738; FAST-P8-NEXT:    fsel f1, f0, f4, f3
739; FAST-P8-NEXT:    blr
740;
741; FAST-P9-LABEL: select_fast_ogt_double:
742; FAST-P9:       # %bb.0: # %entry
743; FAST-P9-NEXT:    xssubdp f0, f2, f1
744; FAST-P9-NEXT:    fsel f1, f0, f4, f3
745; FAST-P9-NEXT:    blr
746;
747; NO-FAST-P8-LABEL: select_fast_ogt_double:
748; NO-FAST-P8:       # %bb.0: # %entry
749; NO-FAST-P8-NEXT:    xssubdp f0, f2, f1
750; NO-FAST-P8-NEXT:    fsel f1, f0, f4, f3
751; NO-FAST-P8-NEXT:    blr
752;
753; NO-FAST-P9-LABEL: select_fast_ogt_double:
754; NO-FAST-P9:       # %bb.0: # %entry
755; NO-FAST-P9-NEXT:    xssubdp f0, f2, f1
756; NO-FAST-P9-NEXT:    fsel f1, f0, f4, f3
757; NO-FAST-P9-NEXT:    blr
758entry:
759  %cmp = fcmp nnan ninf nsz ogt double %a, %b
760  %cond = select i1 %cmp, double %c, double %d
761  ret double %cond
762}
763
764
765; Test ole
766define float @select_ole_float(float %a, float %b, float %c, float %d) {
767; FAST-P8-LABEL: select_ole_float:
768; FAST-P8:       # %bb.0: # %entry
769; FAST-P8-NEXT:    xssubsp f0, f2, f1
770; FAST-P8-NEXT:    fsel f1, f0, f3, f4
771; FAST-P8-NEXT:    blr
772;
773; FAST-P9-LABEL: select_ole_float:
774; FAST-P9:       # %bb.0: # %entry
775; FAST-P9-NEXT:    xssubsp f0, f2, f1
776; FAST-P9-NEXT:    fsel f1, f0, f3, f4
777; FAST-P9-NEXT:    blr
778;
779; NO-FAST-P8-LABEL: select_ole_float:
780; NO-FAST-P8:       # %bb.0: # %entry
781; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
782; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, gt
783; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB20_2
784; NO-FAST-P8-NEXT:  # %bb.1: # %entry
785; NO-FAST-P8-NEXT:    fmr f3, f4
786; NO-FAST-P8-NEXT:  .LBB20_2: # %entry
787; NO-FAST-P8-NEXT:    fmr f1, f3
788; NO-FAST-P8-NEXT:    blr
789;
790; NO-FAST-P9-LABEL: select_ole_float:
791; NO-FAST-P9:       # %bb.0: # %entry
792; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
793; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, gt
794; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB20_2
795; NO-FAST-P9-NEXT:  # %bb.1: # %entry
796; NO-FAST-P9-NEXT:    fmr f3, f4
797; NO-FAST-P9-NEXT:  .LBB20_2: # %entry
798; NO-FAST-P9-NEXT:    fmr f1, f3
799; NO-FAST-P9-NEXT:    blr
800entry:
801  %cmp = fcmp ole float %a, %b
802  %cond = select i1 %cmp, float %c, float %d
803  ret float %cond
804}
805
806define double @select_ole_double(double %a, double %b, double %c, double %d) {
807; FAST-P8-LABEL: select_ole_double:
808; FAST-P8:       # %bb.0: # %entry
809; FAST-P8-NEXT:    xssubdp f0, f2, f1
810; FAST-P8-NEXT:    fsel f1, f0, f3, f4
811; FAST-P8-NEXT:    blr
812;
813; FAST-P9-LABEL: select_ole_double:
814; FAST-P9:       # %bb.0: # %entry
815; FAST-P9-NEXT:    xssubdp f0, f2, f1
816; FAST-P9-NEXT:    fsel f1, f0, f3, f4
817; FAST-P9-NEXT:    blr
818;
819; NO-FAST-P8-LABEL: select_ole_double:
820; NO-FAST-P8:       # %bb.0: # %entry
821; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f2
822; NO-FAST-P8-NEXT:    crnor 4*cr5+lt, un, gt
823; NO-FAST-P8-NEXT:    bc 12, 4*cr5+lt, .LBB21_2
824; NO-FAST-P8-NEXT:  # %bb.1: # %entry
825; NO-FAST-P8-NEXT:    fmr f3, f4
826; NO-FAST-P8-NEXT:  .LBB21_2: # %entry
827; NO-FAST-P8-NEXT:    fmr f1, f3
828; NO-FAST-P8-NEXT:    blr
829;
830; NO-FAST-P9-LABEL: select_ole_double:
831; NO-FAST-P9:       # %bb.0: # %entry
832; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f2
833; NO-FAST-P9-NEXT:    crnor 4*cr5+lt, un, gt
834; NO-FAST-P9-NEXT:    bc 12, 4*cr5+lt, .LBB21_2
835; NO-FAST-P9-NEXT:  # %bb.1: # %entry
836; NO-FAST-P9-NEXT:    fmr f3, f4
837; NO-FAST-P9-NEXT:  .LBB21_2: # %entry
838; NO-FAST-P9-NEXT:    fmr f1, f3
839; NO-FAST-P9-NEXT:    blr
840entry:
841  %cmp = fcmp ole double %a, %b
842  %cond = select i1 %cmp, double %c, double %d
843  ret double %cond
844}
845
846define float @select_fast_ole_float(float %a, float %b, float %c, float %d) {
847; FAST-P8-LABEL: select_fast_ole_float:
848; FAST-P8:       # %bb.0: # %entry
849; FAST-P8-NEXT:    xssubsp f0, f2, f1
850; FAST-P8-NEXT:    fsel f1, f0, f3, f4
851; FAST-P8-NEXT:    blr
852;
853; FAST-P9-LABEL: select_fast_ole_float:
854; FAST-P9:       # %bb.0: # %entry
855; FAST-P9-NEXT:    xssubsp f0, f2, f1
856; FAST-P9-NEXT:    fsel f1, f0, f3, f4
857; FAST-P9-NEXT:    blr
858;
859; NO-FAST-P8-LABEL: select_fast_ole_float:
860; NO-FAST-P8:       # %bb.0: # %entry
861; NO-FAST-P8-NEXT:    xssubsp f0, f2, f1
862; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
863; NO-FAST-P8-NEXT:    blr
864;
865; NO-FAST-P9-LABEL: select_fast_ole_float:
866; NO-FAST-P9:       # %bb.0: # %entry
867; NO-FAST-P9-NEXT:    xssubsp f0, f2, f1
868; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
869; NO-FAST-P9-NEXT:    blr
870entry:
871  %cmp = fcmp nnan ninf nsz ole float %a, %b
872  %cond = select i1 %cmp, float %c, float %d
873  ret float %cond
874}
875
876define double @select_fast_ole_double(double %a, double %b, double %c, double %d) {
877; FAST-P8-LABEL: select_fast_ole_double:
878; FAST-P8:       # %bb.0: # %entry
879; FAST-P8-NEXT:    xssubdp f0, f2, f1
880; FAST-P8-NEXT:    fsel f1, f0, f3, f4
881; FAST-P8-NEXT:    blr
882;
883; FAST-P9-LABEL: select_fast_ole_double:
884; FAST-P9:       # %bb.0: # %entry
885; FAST-P9-NEXT:    xssubdp f0, f2, f1
886; FAST-P9-NEXT:    fsel f1, f0, f3, f4
887; FAST-P9-NEXT:    blr
888;
889; NO-FAST-P8-LABEL: select_fast_ole_double:
890; NO-FAST-P8:       # %bb.0: # %entry
891; NO-FAST-P8-NEXT:    xssubdp f0, f2, f1
892; NO-FAST-P8-NEXT:    fsel f1, f0, f3, f4
893; NO-FAST-P8-NEXT:    blr
894;
895; NO-FAST-P9-LABEL: select_fast_ole_double:
896; NO-FAST-P9:       # %bb.0: # %entry
897; NO-FAST-P9-NEXT:    xssubdp f0, f2, f1
898; NO-FAST-P9-NEXT:    fsel f1, f0, f3, f4
899; NO-FAST-P9-NEXT:    blr
900entry:
901  %cmp = fcmp nnan ninf nsz ole double %a, %b
902  %cond = select i1 %cmp, double %c, double %d
903  ret double %cond
904}
905
906; Test RHS is 1.000000e+00
907define double @onecmp1(double %a, double %y, double %z) {
908; FAST-P8-LABEL: onecmp1:
909; FAST-P8:       # %bb.0: # %entry
910; FAST-P8-NEXT:    vspltisw v2, -1
911; FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
912; FAST-P8-NEXT:    xsadddp f0, f1, f0
913; FAST-P8-NEXT:    fsel f1, f0, f2, f3
914; FAST-P8-NEXT:    blr
915;
916; FAST-P9-LABEL: onecmp1:
917; FAST-P9:       # %bb.0: # %entry
918; FAST-P9-NEXT:    vspltisw v2, -1
919; FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
920; FAST-P9-NEXT:    xsadddp f0, f1, f0
921; FAST-P9-NEXT:    fsel f1, f0, f2, f3
922; FAST-P9-NEXT:    blr
923;
924; NO-FAST-P8-LABEL: onecmp1:
925; NO-FAST-P8:       # %bb.0: # %entry
926; NO-FAST-P8-NEXT:    vspltisw v2, 1
927; NO-FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
928; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f0
929; NO-FAST-P8-NEXT:    bc 12, lt, .LBB24_3
930; NO-FAST-P8-NEXT:  # %bb.1: # %entry
931; NO-FAST-P8-NEXT:    fcmpu cr0, f1, f1
932; NO-FAST-P8-NEXT:    bc 12, un, .LBB24_3
933; NO-FAST-P8-NEXT:  # %bb.2: # %entry
934; NO-FAST-P8-NEXT:    fmr f3, f2
935; NO-FAST-P8-NEXT:  .LBB24_3: # %entry
936; NO-FAST-P8-NEXT:    fmr f1, f3
937; NO-FAST-P8-NEXT:    blr
938;
939; NO-FAST-P9-LABEL: onecmp1:
940; NO-FAST-P9:       # %bb.0: # %entry
941; NO-FAST-P9-NEXT:    vspltisw v2, 1
942; NO-FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
943; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f0
944; NO-FAST-P9-NEXT:    bc 12, lt, .LBB24_3
945; NO-FAST-P9-NEXT:  # %bb.1: # %entry
946; NO-FAST-P9-NEXT:    fcmpu cr0, f1, f1
947; NO-FAST-P9-NEXT:    bc 12, un, .LBB24_3
948; NO-FAST-P9-NEXT:  # %bb.2: # %entry
949; NO-FAST-P9-NEXT:    fmr f3, f2
950; NO-FAST-P9-NEXT:  .LBB24_3: # %entry
951; NO-FAST-P9-NEXT:    fmr f1, f3
952; NO-FAST-P9-NEXT:    blr
953entry:
954  %cmp = fcmp ult double %a, 1.000000e+00
955  %z.y = select i1 %cmp, double %z, double %y
956  ret double %z.y
957}
958
959define double @onecmp2(double %a, double %y, double %z) {
960; FAST-P8-LABEL: onecmp2:
961; FAST-P8:       # %bb.0: # %entry
962; FAST-P8-NEXT:    vspltisw v2, 1
963; FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
964; FAST-P8-NEXT:    xssubdp f0, f0, f1
965; FAST-P8-NEXT:    fsel f1, f0, f3, f2
966; FAST-P8-NEXT:    blr
967;
968; FAST-P9-LABEL: onecmp2:
969; FAST-P9:       # %bb.0: # %entry
970; FAST-P9-NEXT:    vspltisw v2, 1
971; FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
972; FAST-P9-NEXT:    xssubdp f0, f0, f1
973; FAST-P9-NEXT:    fsel f1, f0, f3, f2
974; FAST-P9-NEXT:    blr
975;
976; NO-FAST-P8-LABEL: onecmp2:
977; NO-FAST-P8:       # %bb.0: # %entry
978; NO-FAST-P8-NEXT:    vspltisw v2, 1
979; NO-FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
980; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f0
981; NO-FAST-P8-NEXT:    bgt cr0, .LBB25_2
982; NO-FAST-P8-NEXT:  # %bb.1: # %entry
983; NO-FAST-P8-NEXT:    fmr f2, f3
984; NO-FAST-P8-NEXT:  .LBB25_2: # %entry
985; NO-FAST-P8-NEXT:    fmr f1, f2
986; NO-FAST-P8-NEXT:    blr
987;
988; NO-FAST-P9-LABEL: onecmp2:
989; NO-FAST-P9:       # %bb.0: # %entry
990; NO-FAST-P9-NEXT:    vspltisw v2, 1
991; NO-FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
992; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f0
993; NO-FAST-P9-NEXT:    bgt cr0, .LBB25_2
994; NO-FAST-P9-NEXT:  # %bb.1: # %entry
995; NO-FAST-P9-NEXT:    fmr f2, f3
996; NO-FAST-P9-NEXT:  .LBB25_2: # %entry
997; NO-FAST-P9-NEXT:    fmr f1, f2
998; NO-FAST-P9-NEXT:    blr
999entry:
1000  %cmp = fcmp ogt double %a, 1.000000e+00
1001  %y.z = select i1 %cmp, double %y, double %z
1002  ret double %y.z
1003}
1004
1005define double @onecmp3(double %a, double %y, double %z) {
1006; FAST-P8-LABEL: onecmp3:
1007; FAST-P8:       # %bb.0: # %entry
1008; FAST-P8-NEXT:    vspltisw v2, -1
1009; FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
1010; FAST-P8-NEXT:    xsadddp f0, f1, f0
1011; FAST-P8-NEXT:    fsel f1, f0, f2, f3
1012; FAST-P8-NEXT:    xsnegdp f0, f0
1013; FAST-P8-NEXT:    fsel f1, f0, f1, f3
1014; FAST-P8-NEXT:    blr
1015;
1016; FAST-P9-LABEL: onecmp3:
1017; FAST-P9:       # %bb.0: # %entry
1018; FAST-P9-NEXT:    vspltisw v2, -1
1019; FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
1020; FAST-P9-NEXT:    xsadddp f0, f1, f0
1021; FAST-P9-NEXT:    fsel f1, f0, f2, f3
1022; FAST-P9-NEXT:    xsnegdp f0, f0
1023; FAST-P9-NEXT:    fsel f1, f0, f1, f3
1024; FAST-P9-NEXT:    blr
1025;
1026; NO-FAST-P8-LABEL: onecmp3:
1027; NO-FAST-P8:       # %bb.0: # %entry
1028; NO-FAST-P8-NEXT:    vspltisw v2, 1
1029; NO-FAST-P8-NEXT:    xvcvsxwdp vs0, vs34
1030; NO-FAST-P8-NEXT:    xscmpudp cr0, f1, f0
1031; NO-FAST-P8-NEXT:    beq cr0, .LBB26_2
1032; NO-FAST-P8-NEXT:  # %bb.1: # %entry
1033; NO-FAST-P8-NEXT:    fmr f2, f3
1034; NO-FAST-P8-NEXT:  .LBB26_2: # %entry
1035; NO-FAST-P8-NEXT:    fmr f1, f2
1036; NO-FAST-P8-NEXT:    blr
1037;
1038; NO-FAST-P9-LABEL: onecmp3:
1039; NO-FAST-P9:       # %bb.0: # %entry
1040; NO-FAST-P9-NEXT:    vspltisw v2, 1
1041; NO-FAST-P9-NEXT:    xvcvsxwdp vs0, vs34
1042; NO-FAST-P9-NEXT:    xscmpudp cr0, f1, f0
1043; NO-FAST-P9-NEXT:    beq cr0, .LBB26_2
1044; NO-FAST-P9-NEXT:  # %bb.1: # %entry
1045; NO-FAST-P9-NEXT:    fmr f2, f3
1046; NO-FAST-P9-NEXT:  .LBB26_2: # %entry
1047; NO-FAST-P9-NEXT:    fmr f1, f2
1048; NO-FAST-P9-NEXT:    blr
1049entry:
1050  %cmp = fcmp oeq double %a, 1.000000e+00
1051  %y.z = select i1 %cmp, double %y, double %z
1052  ret double %y.z
1053}
1054