1 ; RUN: llc < %s -mtriple armv8 -mattr=+neon,+fp-armv8 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s
5 define float @fp-armv8_vminnm_o(float %a, float %b) {
6 ; CHECK-LABEL: "fp-armv8_vminnm_o":
9 %cmp = fcmp fast olt float %a, %b
10 %cond = select i1 %cmp, float %a, float %b
14 define double @fp-armv8_vminnm_ole(double %a, double %b) {
15 ; CHECK-LABEL: "fp-armv8_vminnm_ole":
18 %cmp = fcmp fast ole double %a, %b
19 %cond = select i1 %cmp, double %a, double %b
23 define float @fp-armv8_vminnm_o_rev(float %a, float %b) {
24 ; CHECK-LABEL: "fp-armv8_vminnm_o_rev":
27 %cmp = fcmp fast ogt float %a, %b
28 %cond = select i1 %cmp, float %b, float %a
32 define double @fp-armv8_vminnm_oge_rev(double %a, double %b) {
33 ; CHECK-LABEL: "fp-armv8_vminnm_oge_rev":
36 %cmp = fcmp fast oge double %a, %b
37 %cond = select i1 %cmp, double %b, double %a
41 define float @fp-armv8_vminnm_u(float %a, float %b) {
42 ; CHECK-LABEL: "fp-armv8_vminnm_u":
45 %cmp = fcmp fast ult float %a, %b
46 %cond = select i1 %cmp, float %a, float %b
50 define float @fp-armv8_vminnm_ule(float %a, float %b) {
51 ; CHECK-LABEL: "fp-armv8_vminnm_ule":
54 %cmp = fcmp fast ule float %a, %b
55 %cond = select i1 %cmp, float %a, float %b
59 define float @fp-armv8_vminnm_u_rev(float %a, float %b) {
60 ; CHECK-LABEL: "fp-armv8_vminnm_u_rev":
63 %cmp = fcmp fast ugt float %a, %b
64 %cond = select i1 %cmp, float %b, float %a
68 define double @fp-armv8_vminnm_uge_rev(double %a, double %b) {
69 ; CHECK-LABEL: "fp-armv8_vminnm_uge_rev":
72 %cmp = fcmp fast uge double %a, %b
73 %cond = select i1 %cmp, double %b, double %a
77 define float @fp-armv8_vmaxnm_o(float %a, float %b) {
78 ; CHECK-LABEL: "fp-armv8_vmaxnm_o":
81 %cmp = fcmp fast ogt float %a, %b
82 %cond = select i1 %cmp, float %a, float %b
86 define float @fp-armv8_vmaxnm_oge(float %a, float %b) {
87 ; CHECK-LABEL: "fp-armv8_vmaxnm_oge":
90 %cmp = fcmp fast oge float %a, %b
91 %cond = select i1 %cmp, float %a, float %b
95 define float @fp-armv8_vmaxnm_o_rev(float %a, float %b) {
96 ; CHECK-LABEL: "fp-armv8_vmaxnm_o_rev":
99 %cmp = fcmp fast olt float %a, %b
100 %cond = select i1 %cmp, float %b, float %a
104 define float @fp-armv8_vmaxnm_ole_rev(float %a, float %b) {
105 ; CHECK-LABEL: "fp-armv8_vmaxnm_ole_rev":
108 %cmp = fcmp fast ole float %a, %b
109 %cond = select i1 %cmp, float %b, float %a
113 define float @fp-armv8_vmaxnm_u(float %a, float %b) {
114 ; CHECK-LABEL: "fp-armv8_vmaxnm_u":
117 %cmp = fcmp fast ugt float %a, %b
118 %cond = select i1 %cmp, float %a, float %b
122 define float @fp-armv8_vmaxnm_uge(float %a, float %b) {
123 ; CHECK-LABEL: "fp-armv8_vmaxnm_uge":
126 %cmp = fcmp fast uge float %a, %b
127 %cond = select i1 %cmp, float %a, float %b
131 define float @fp-armv8_vmaxnm_u_rev(float %a, float %b) {
132 ; CHECK-LABEL: "fp-armv8_vmaxnm_u_rev":
135 %cmp = fcmp fast ult float %a, %b
136 %cond = select i1 %cmp, float %b, float %a
140 define double @fp-armv8_vmaxnm_ule_rev(double %a, double %b) {
141 ; CHECK-LABEL: "fp-armv8_vmaxnm_ule_rev":
144 %cmp = fcmp fast ule double %a, %b
145 %cond = select i1 %cmp, double %b, double %a
151 define float @fp-armv8_vminnm_NNNo(float %a) {
152 ; CHECK-LABEL: "fp-armv8_vminnm_NNNo":
155 %cmp1 = fcmp fast olt float %a, 12.
156 %cond1 = select i1 %cmp1, float %a, float 12.
157 %cmp2 = fcmp fast olt float 34., %cond1
158 %cond2 = select i1 %cmp2, float 34., float %cond1
162 define double @fp-armv8_vminnm_NNNole(double %a) {
163 ; CHECK-LABEL: "fp-armv8_vminnm_NNNole":
166 %cmp1 = fcmp fast ole double %a, 34.
167 %cond1 = select i1 %cmp1, double %a, double 34.
168 %cmp2 = fcmp fast ole double 56., %cond1
169 %cond2 = select i1 %cmp2, double 56., double %cond1
173 define float @fp-armv8_vminnm_NNNo_rev(float %a) {
174 ; CHECK-LABEL: "fp-armv8_vminnm_NNNo_rev":
177 %cmp1 = fcmp fast ogt float %a, 56.
178 %cond1 = select i1 %cmp1, float 56., float %a
179 %cmp2 = fcmp fast ogt float 78., %cond1
180 %cond2 = select i1 %cmp2, float %cond1, float 78.
184 define double @fp-armv8_vminnm_NNNoge_rev(double %a) {
185 ; CHECK-LABEL: "fp-armv8_vminnm_NNNoge_rev":
188 %cmp1 = fcmp fast oge double %a, 78.
189 %cond1 = select i1 %cmp1, double 78., double %a
190 %cmp2 = fcmp fast oge double 90., %cond1
191 %cond2 = select i1 %cmp2, double %cond1, double 90.
195 define float @fp-armv8_vminnm_NNNu(float %b) {
196 ; CHECK-LABEL: "fp-armv8_vminnm_NNNu":
199 %cmp1 = fcmp fast ult float 12., %b
200 %cond1 = select i1 %cmp1, float 12., float %b
201 %cmp2 = fcmp fast ult float %cond1, 34.
202 %cond2 = select i1 %cmp2, float %cond1, float 34.
206 define float @fp-armv8_vminnm_NNNule(float %b) {
207 ; CHECK-LABEL: "fp-armv8_vminnm_NNNule":
210 %cmp1 = fcmp fast ule float 34., %b
211 %cond1 = select i1 %cmp1, float 34., float %b
212 %cmp2 = fcmp fast ule float %cond1, 56.
213 %cond2 = select i1 %cmp2, float %cond1, float 56.
217 define float @fp-armv8_vminnm_NNNu_rev(float %b) {
218 ; CHECK-LABEL: "fp-armv8_vminnm_NNNu_rev":
221 %cmp1 = fcmp fast ugt float 56., %b
222 %cond1 = select i1 %cmp1, float %b, float 56.
223 %cmp2 = fcmp fast ugt float %cond1, 78.
224 %cond2 = select i1 %cmp2, float 78., float %cond1
228 define double @fp-armv8_vminnm_NNNuge_rev(double %b) {
229 ; CHECK-LABEL: "fp-armv8_vminnm_NNNuge_rev":
232 %cmp1 = fcmp fast uge double 78., %b
233 %cond1 = select i1 %cmp1, double %b, double 78.
234 %cmp2 = fcmp fast uge double %cond1, 90.
235 %cond2 = select i1 %cmp2, double 90., double %cond1
239 define float @fp-armv8_vmaxnm_NNNo(float %a) {
240 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNo":
243 %cmp1 = fcmp fast ogt float %a, 12.
244 %cond1 = select i1 %cmp1, float %a, float 12.
245 %cmp2 = fcmp fast ogt float 34., %cond1
246 %cond2 = select i1 %cmp2, float 34., float %cond1
250 define float @fp-armv8_vmaxnm_NNNoge(float %a) {
251 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNoge":
254 %cmp1 = fcmp fast oge float %a, 34.
255 %cond1 = select i1 %cmp1, float %a, float 34.
256 %cmp2 = fcmp fast oge float 56., %cond1
257 %cond2 = select i1 %cmp2, float 56., float %cond1
261 define float @fp-armv8_vmaxnm_NNNo_rev(float %a) {
262 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNo_rev":
265 %cmp1 = fcmp fast olt float %a, 56.
266 %cond1 = select i1 %cmp1, float 56., float %a
267 %cmp2 = fcmp fast olt float 78., %cond1
268 %cond2 = select i1 %cmp2, float %cond1, float 78.
272 define float @fp-armv8_vmaxnm_NNNole_rev(float %a) {
273 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNole_rev":
276 %cmp1 = fcmp fast ole float %a, 78.
277 %cond1 = select i1 %cmp1, float 78., float %a
278 %cmp2 = fcmp fast ole float 90., %cond1
279 %cond2 = select i1 %cmp2, float %cond1, float 90.
283 define float @fp-armv8_vmaxnm_NNNu(float %b) {
284 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNu":
287 %cmp1 = fcmp fast ugt float 12., %b
288 %cond1 = select i1 %cmp1, float 12., float %b
289 %cmp2 = fcmp fast ugt float %cond1, 34.
290 %cond2 = select i1 %cmp2, float %cond1, float 34.
294 define float @fp-armv8_vmaxnm_NNNuge(float %b) {
295 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNuge":
298 %cmp1 = fcmp fast uge float 34., %b
299 %cond1 = select i1 %cmp1, float 34., float %b
300 %cmp2 = fcmp fast uge float %cond1, 56.
301 %cond2 = select i1 %cmp2, float %cond1, float 56.
305 define float @fp-armv8_vmaxnm_NNNu_rev(float %b) {
306 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNu_rev":
309 %cmp1 = fcmp fast ult float 56., %b
310 %cond1 = select i1 %cmp1, float %b, float 56.
311 %cmp2 = fcmp fast ult float %cond1, 78.
312 %cond2 = select i1 %cmp2, float 78., float %cond1
316 define double @fp-armv8_vmaxnm_NNNule_rev( double %b) {
317 ; CHECK-LABEL: "fp-armv8_vmaxnm_NNNule_rev":
320 %cmp1 = fcmp fast ule double 78., %b
321 %cond1 = select i1 %cmp1, double %b, double 78.
322 %cmp2 = fcmp fast ule double %cond1, 90.
323 %cond2 = select i1 %cmp2, double 90., double %cond1
327 define float @fp-armv8_vminmaxnm_0(float %a) {
328 ; CHECK-LABEL: "fp-armv8_vminmaxnm_0":
332 %cmp1 = fcmp fast olt float %a, 0.
333 %cond1 = select i1 %cmp1, float %a, float 0.
334 %cmp2 = fcmp fast ogt float %cond1, 0.
335 %cond2 = select i1 %cmp2, float %cond1, float 0.
339 define float @fp-armv8_vminmaxnm_neg0(float %a) {
340 ; CHECK-LABEL: "fp-armv8_vminmaxnm_neg0":
344 %cmp1 = fcmp fast olt float %a, -0.
345 %cond1 = select i1 %cmp1, float %a, float -0.
346 %cmp2 = fcmp fast ugt float %cond1, -0.
347 %cond2 = select i1 %cmp2, float %cond1, float -0.
351 define float @fp-armv8_vminmaxnm_e_0(float %a) {
352 ; CHECK-LABEL: "fp-armv8_vminmaxnm_e_0":
356 %cmp1 = fcmp fast ule float 0., %a
357 %cond1 = select i1 %cmp1, float 0., float %a
358 %cmp2 = fcmp fast uge float 0., %cond1
359 %cond2 = select i1 %cmp2, float 0., float %cond1
363 define float @fp-armv8_vminmaxnm_e_neg0(float %a) {
364 ; CHECK-LABEL: "fp-armv8_vminmaxnm_e_neg0":
368 %cmp1 = fcmp fast ule float -0., %a
369 %cond1 = select i1 %cmp1, float -0., float %a
370 %cmp2 = fcmp fast oge float -0., %cond1
371 %cond2 = select i1 %cmp2, float -0., float %cond1
375 declare <4 x float> @llvm.arm.neon.vminnm.v4f32(<4 x float>, <4 x float>) nounwind readnone
376 declare <2 x float> @llvm.arm.neon.vminnm.v2f32(<2 x float>, <2 x float>) nounwind readnone
377 declare <4 x float> @llvm.arm.neon.vmaxnm.v4f32(<4 x float>, <4 x float>) nounwind readnone
378 declare <2 x float> @llvm.arm.neon.vmaxnm.v2f32(<2 x float>, <2 x float>) nounwind readnone