]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/AArch64/arm64-fmax.ll
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / CodeGen / AArch64 / arm64-fmax.ll
1 ; RUN: llc -march=arm64 -enable-no-nans-fp-math < %s | FileCheck %s
2
3 define double @test_direct(float %in) #1 {
4 ; CHECK-LABEL: test_direct:
5   %cmp = fcmp olt float %in, 0.000000e+00
6   %longer = fpext float %in to double
7   %val = select i1 %cmp, double 0.000000e+00, double %longer
8   ret double %val
9
10 ; CHECK: fmax
11 }
12
13 define double @test_cross(float %in) #1 {
14 ; CHECK-LABEL: test_cross:
15   %cmp = fcmp olt float %in, 0.000000e+00
16   %longer = fpext float %in to double
17   %val = select i1 %cmp, double %longer, double 0.000000e+00
18   ret double %val
19
20 ; CHECK: fmin
21 }
22
23 ; This isn't a min or a max, but passes the first condition for swapping the
24 ; results. Make sure they're put back before we resort to the normal fcsel.
25 define float @test_cross_fail(float %lhs, float %rhs) {
26 ; CHECK-LABEL: test_cross_fail:
27   %tst = fcmp une float %lhs, %rhs
28   %res = select i1 %tst, float %rhs, float %lhs
29   ret float %res
30
31   ; The register allocator would have to decide to be deliberately obtuse before
32   ; other register were used.
33 ; CHECK: fcsel s0, s1, s0, ne
34 }