brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · aec31ec Raw
75 lines · plain
1; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s2 3define double @test_direct(float %in) {4; CHECK-LABEL: test_direct:5  %cmp = fcmp olt float %in, 0.000000e+006  %val = select i1 %cmp, float 0.000000e+00, float %in7  %longer = fpext float %val to double8  ret double %longer9 10; CHECK: fcmp11; CHECK: fcsel12}13 14define double @test_cross(float %in) {15; CHECK-LABEL: test_cross:16  %cmp = fcmp ult float %in, 0.000000e+0017  %val = select i1 %cmp, float %in, float 0.000000e+0018  %longer = fpext float %val to double19  ret double %longer20 21; CHECK: fcmp22; CHECK: fcsel23}24 25; Same as previous, but with ordered comparison;26; must become fminnm, not fmin.27define double @test_cross_fail_nan(float %in) {28; CHECK-LABEL: test_cross_fail_nan:29  %cmp = fcmp olt float %in, 0.000000e+0030  %val = select i1 %cmp, float %in, float 0.000000e+0031  %longer = fpext float %val to double32  ret double %longer33 34; CHECK: fminnm s35}36 37; This isn't a min or a max, but passes the first condition for swapping the38; results. Make sure they're put back before we resort to the normal fcsel.39define float @test_cross_fail(float %lhs, float %rhs) {40; CHECK-LABEL: test_cross_fail:41  %tst = fcmp une float %lhs, %rhs42  %res = select i1 %tst, float %rhs, float %lhs43  ret float %res44 45  ; The register allocator would have to decide to be deliberately obtuse before46  ; other register were used.47; CHECK: fcsel s0, s1, s0, ne48}49 50; Make sure the transformation isn't triggered for integers51define i64 @test_integer(i64  %in) {52  %cmp = icmp slt i64 %in, 053  %val = select i1 %cmp, i64 0, i64 %in54  ret i64 %val55}56 57; Make sure we don't translate it into fminnm when the nsz flag is set on the fcmp.58define float @minnum_fcmp_nsz(float %x, float %y) {59; CHECK-LABEL: minnum_fcmp_nsz:60  %cmp = fcmp nnan nsz ole float %x, %y61  %sel = select i1 %cmp, float %x, float %y62  ret float %sel63; CHECK-NOT: fminnm64; CHECK: fcsel s0, s0, s1, le65}66 67; Make sure we translate it into fminnm when the nsz flag is set on the select.68define float @minnum_select_nsz(float %x, float %y) {69; CHECK-LABEL: minnum_select_nsz:70  %cmp = fcmp nnan ole float %x, %y71  %sel = select nsz i1 %cmp, float %x, float %y72  ret float %sel73; CHECK: fminnm s0, s0, s174}75