xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/vminmaxnm.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple armv8 -mattr=+neon,+fp-armv8 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; scalars
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_o(float %a, float %b) {
6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_o":
7*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
8*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
9*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast olt float %a, %b
10*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
11*9880d681SAndroid Build Coastguard Worker  ret float %cond
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_ole(double %a, double %b) {
15*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_ole":
16*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
17*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
18*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ole double %a, %b
19*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, double %a, double %b
20*9880d681SAndroid Build Coastguard Worker  ret double %cond
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_o_rev(float %a, float %b) {
24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_o_rev":
25*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
26*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
27*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ogt float %a, %b
28*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %b, float %a
29*9880d681SAndroid Build Coastguard Worker  ret float %cond
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_oge_rev(double %a, double %b) {
33*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_oge_rev":
34*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
35*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
36*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast oge double %a, %b
37*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, double %b, double %a
38*9880d681SAndroid Build Coastguard Worker  ret double %cond
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_u(float %a, float %b) {
42*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_u":
43*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
44*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
45*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ult float %a, %b
46*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
47*9880d681SAndroid Build Coastguard Worker  ret float %cond
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_ule(float %a, float %b) {
51*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_ule":
52*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
53*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
54*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ule float %a, %b
55*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
56*9880d681SAndroid Build Coastguard Worker  ret float %cond
57*9880d681SAndroid Build Coastguard Worker}
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_u_rev(float %a, float %b) {
60*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_u_rev":
61*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
62*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
63*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ugt float %a, %b
64*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %b, float %a
65*9880d681SAndroid Build Coastguard Worker  ret float %cond
66*9880d681SAndroid Build Coastguard Worker}
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_uge_rev(double %a, double %b) {
69*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_uge_rev":
70*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
71*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
72*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast uge double %a, %b
73*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, double %b, double %a
74*9880d681SAndroid Build Coastguard Worker  ret double %cond
75*9880d681SAndroid Build Coastguard Worker}
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_o(float %a, float %b) {
78*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_o":
79*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
80*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
81*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ogt float %a, %b
82*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
83*9880d681SAndroid Build Coastguard Worker  ret float %cond
84*9880d681SAndroid Build Coastguard Worker}
85*9880d681SAndroid Build Coastguard Worker
86*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_oge(float %a, float %b) {
87*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_oge":
88*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
89*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
90*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast oge float %a, %b
91*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
92*9880d681SAndroid Build Coastguard Worker  ret float %cond
93*9880d681SAndroid Build Coastguard Worker}
94*9880d681SAndroid Build Coastguard Worker
95*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_o_rev(float %a, float %b) {
96*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_o_rev":
97*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
98*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
99*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast olt float %a, %b
100*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %b, float %a
101*9880d681SAndroid Build Coastguard Worker  ret float %cond
102*9880d681SAndroid Build Coastguard Worker}
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_ole_rev(float %a, float %b) {
105*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_ole_rev":
106*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
107*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
108*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ole float %a, %b
109*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %b, float %a
110*9880d681SAndroid Build Coastguard Worker  ret float %cond
111*9880d681SAndroid Build Coastguard Worker}
112*9880d681SAndroid Build Coastguard Worker
113*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_u(float %a, float %b) {
114*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_u":
115*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
116*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
117*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ugt float %a, %b
118*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
119*9880d681SAndroid Build Coastguard Worker  ret float %cond
120*9880d681SAndroid Build Coastguard Worker}
121*9880d681SAndroid Build Coastguard Worker
122*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_uge(float %a, float %b) {
123*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_uge":
124*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
125*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
126*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast uge float %a, %b
127*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %a, float %b
128*9880d681SAndroid Build Coastguard Worker  ret float %cond
129*9880d681SAndroid Build Coastguard Worker}
130*9880d681SAndroid Build Coastguard Worker
131*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_u_rev(float %a, float %b) {
132*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_u_rev":
133*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
134*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
135*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ult float %a, %b
136*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, float %b, float %a
137*9880d681SAndroid Build Coastguard Worker  ret float %cond
138*9880d681SAndroid Build Coastguard Worker}
139*9880d681SAndroid Build Coastguard Worker
140*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vmaxnm_ule_rev(double %a, double %b) {
141*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_ule_rev":
142*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
143*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f64
144*9880d681SAndroid Build Coastguard Worker  %cmp = fcmp fast ule double %a, %b
145*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %cmp, double %b, double %a
146*9880d681SAndroid Build Coastguard Worker  ret double %cond
147*9880d681SAndroid Build Coastguard Worker}
148*9880d681SAndroid Build Coastguard Worker
149*9880d681SAndroid Build Coastguard Worker; known non-NaNs
150*9880d681SAndroid Build Coastguard Worker
151*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_NNNo(float %a) {
152*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNo":
153*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
154*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
155*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast olt float %a, 12.
156*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %a, float 12.
157*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast olt float 34., %cond1
158*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 34., float %cond1
159*9880d681SAndroid Build Coastguard Worker  ret float %cond2
160*9880d681SAndroid Build Coastguard Worker}
161*9880d681SAndroid Build Coastguard Worker
162*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_NNNole(double %a) {
163*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNole":
164*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
165*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
166*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ole double %a, 34.
167*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, double %a, double 34.
168*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ole double 56., %cond1
169*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, double 56., double %cond1
170*9880d681SAndroid Build Coastguard Worker  ret double %cond2
171*9880d681SAndroid Build Coastguard Worker}
172*9880d681SAndroid Build Coastguard Worker
173*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_NNNo_rev(float %a) {
174*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNo_rev":
175*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
176*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
177*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ogt float %a, 56.
178*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 56., float %a
179*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ogt float 78., %cond1
180*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 78.
181*9880d681SAndroid Build Coastguard Worker  ret float %cond2
182*9880d681SAndroid Build Coastguard Worker}
183*9880d681SAndroid Build Coastguard Worker
184*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_NNNoge_rev(double %a) {
185*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNoge_rev":
186*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
187*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
188*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast oge double %a, 78.
189*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, double 78., double %a
190*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast oge double 90., %cond1
191*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, double %cond1, double 90.
192*9880d681SAndroid Build Coastguard Worker  ret double %cond2
193*9880d681SAndroid Build Coastguard Worker}
194*9880d681SAndroid Build Coastguard Worker
195*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_NNNu(float %b) {
196*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNu":
197*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
198*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
199*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ult float 12., %b
200*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 12., float %b
201*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ult float %cond1, 34.
202*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 34.
203*9880d681SAndroid Build Coastguard Worker  ret float %cond2
204*9880d681SAndroid Build Coastguard Worker}
205*9880d681SAndroid Build Coastguard Worker
206*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_NNNule(float %b) {
207*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNule":
208*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
209*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
210*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ule float 34., %b
211*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 34., float %b
212*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ule float %cond1, 56.
213*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 56.
214*9880d681SAndroid Build Coastguard Worker  ret float %cond2
215*9880d681SAndroid Build Coastguard Worker}
216*9880d681SAndroid Build Coastguard Worker
217*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminnm_NNNu_rev(float %b) {
218*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNu_rev":
219*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
220*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
221*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ugt float 56., %b
222*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %b, float 56.
223*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ugt float %cond1, 78.
224*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 78., float %cond1
225*9880d681SAndroid Build Coastguard Worker  ret float %cond2
226*9880d681SAndroid Build Coastguard Worker}
227*9880d681SAndroid Build Coastguard Worker
228*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vminnm_NNNuge_rev(double %b) {
229*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminnm_NNNuge_rev":
230*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
231*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f64
232*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast uge double 78., %b
233*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, double %b, double 78.
234*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast uge double %cond1, 90.
235*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, double 90., double %cond1
236*9880d681SAndroid Build Coastguard Worker  ret double %cond2
237*9880d681SAndroid Build Coastguard Worker}
238*9880d681SAndroid Build Coastguard Worker
239*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNo(float %a) {
240*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNo":
241*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
242*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
243*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ogt float %a, 12.
244*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %a, float 12.
245*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ogt float 34., %cond1
246*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 34., float %cond1
247*9880d681SAndroid Build Coastguard Worker  ret float %cond2
248*9880d681SAndroid Build Coastguard Worker}
249*9880d681SAndroid Build Coastguard Worker
250*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNoge(float %a) {
251*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNoge":
252*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
253*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
254*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast oge float %a, 34.
255*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %a, float 34.
256*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast oge float 56., %cond1
257*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 56., float %cond1
258*9880d681SAndroid Build Coastguard Worker  ret float %cond2
259*9880d681SAndroid Build Coastguard Worker}
260*9880d681SAndroid Build Coastguard Worker
261*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNo_rev(float %a) {
262*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNo_rev":
263*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
264*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
265*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast olt float %a, 56.
266*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 56., float %a
267*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast olt float 78., %cond1
268*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 78.
269*9880d681SAndroid Build Coastguard Worker  ret float %cond2
270*9880d681SAndroid Build Coastguard Worker}
271*9880d681SAndroid Build Coastguard Worker
272*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNole_rev(float %a) {
273*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNole_rev":
274*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
275*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
276*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ole float %a, 78.
277*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 78., float %a
278*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ole float 90., %cond1
279*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 90.
280*9880d681SAndroid Build Coastguard Worker  ret float %cond2
281*9880d681SAndroid Build Coastguard Worker}
282*9880d681SAndroid Build Coastguard Worker
283*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNu(float %b) {
284*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNu":
285*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
286*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
287*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ugt float 12., %b
288*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 12., float %b
289*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ugt float %cond1, 34.
290*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 34.
291*9880d681SAndroid Build Coastguard Worker  ret float %cond2
292*9880d681SAndroid Build Coastguard Worker}
293*9880d681SAndroid Build Coastguard Worker
294*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNuge(float %b) {
295*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNuge":
296*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
297*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
298*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast uge float 34., %b
299*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 34., float %b
300*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast uge float %cond1, 56.
301*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 56.
302*9880d681SAndroid Build Coastguard Worker  ret float %cond2
303*9880d681SAndroid Build Coastguard Worker}
304*9880d681SAndroid Build Coastguard Worker
305*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vmaxnm_NNNu_rev(float %b) {
306*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNu_rev":
307*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
308*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
309*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ult float 56., %b
310*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %b, float 56.
311*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ult float %cond1, 78.
312*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 78., float %cond1
313*9880d681SAndroid Build Coastguard Worker  ret float %cond2
314*9880d681SAndroid Build Coastguard Worker}
315*9880d681SAndroid Build Coastguard Worker
316*9880d681SAndroid Build Coastguard Workerdefine double @fp-armv8_vmaxnm_NNNule_rev( double %b) {
317*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vmaxnm_NNNule_rev":
318*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f64
319*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f64
320*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ule double 78., %b
321*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, double %b, double 78.
322*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ule double %cond1, 90.
323*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, double 90., double %cond1
324*9880d681SAndroid Build Coastguard Worker  ret double %cond2
325*9880d681SAndroid Build Coastguard Worker}
326*9880d681SAndroid Build Coastguard Worker
327*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminmaxnm_0(float %a) {
328*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminmaxnm_0":
329*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
330*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
331*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
332*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast olt float %a, 0.
333*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %a, float 0.
334*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ogt float %cond1, 0.
335*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float 0.
336*9880d681SAndroid Build Coastguard Worker  ret float %cond2
337*9880d681SAndroid Build Coastguard Worker}
338*9880d681SAndroid Build Coastguard Worker
339*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminmaxnm_neg0(float %a) {
340*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminmaxnm_neg0":
341*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
342*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
343*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
344*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast olt float %a, -0.
345*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float %a, float -0.
346*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast ugt float %cond1, -0.
347*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float %cond1, float -0.
348*9880d681SAndroid Build Coastguard Worker  ret float %cond2
349*9880d681SAndroid Build Coastguard Worker}
350*9880d681SAndroid Build Coastguard Worker
351*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminmaxnm_e_0(float %a) {
352*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminmaxnm_e_0":
353*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
354*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
355*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
356*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ule float 0., %a
357*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float 0., float %a
358*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast uge float 0., %cond1
359*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float 0., float %cond1
360*9880d681SAndroid Build Coastguard Worker  ret float %cond2
361*9880d681SAndroid Build Coastguard Worker}
362*9880d681SAndroid Build Coastguard Worker
363*9880d681SAndroid Build Coastguard Workerdefine float @fp-armv8_vminmaxnm_e_neg0(float %a) {
364*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: "fp-armv8_vminmaxnm_e_neg0":
365*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: vcmp
366*9880d681SAndroid Build Coastguard Worker; CHECK: vminnm.f32
367*9880d681SAndroid Build Coastguard Worker; CHECK: vmaxnm.f32
368*9880d681SAndroid Build Coastguard Worker  %cmp1 = fcmp fast ule float -0., %a
369*9880d681SAndroid Build Coastguard Worker  %cond1 = select i1 %cmp1, float -0., float %a
370*9880d681SAndroid Build Coastguard Worker  %cmp2 = fcmp fast oge float -0., %cond1
371*9880d681SAndroid Build Coastguard Worker  %cond2 = select i1 %cmp2, float -0., float %cond1
372*9880d681SAndroid Build Coastguard Worker  ret float %cond2
373*9880d681SAndroid Build Coastguard Worker}
374*9880d681SAndroid Build Coastguard Worker
375*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.arm.neon.vminnm.v4f32(<4 x float>, <4 x float>) nounwind readnone
376*9880d681SAndroid Build Coastguard Workerdeclare <2 x float> @llvm.arm.neon.vminnm.v2f32(<2 x float>, <2 x float>) nounwind readnone
377*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.arm.neon.vmaxnm.v4f32(<4 x float>, <4 x float>) nounwind readnone
378*9880d681SAndroid Build Coastguard Workerdeclare <2 x float> @llvm.arm.neon.vmaxnm.v2f32(<2 x float>, <2 x float>) nounwind readnone
379