diff options
author | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2018-02-16 09:23:59 +0000 |
---|---|---|
committer | Roger Ferrer Ibanez <roger.ferreribanez@arm.com> | 2018-02-16 09:23:59 +0000 |
commit | d41059a9f6d04d3314636f6da524ba74b3442f3b (patch) | |
tree | 8703db1755eb01d1909401ce4efe91baef9dc7bd /llvm/test/CodeGen/Thumb2/float-cmp.ll | |
parent | 42a16192626c01b1cada04c51893f153f95c8698 (diff) | |
download | bcm5719-llvm-d41059a9f6d04d3314636f6da524ba74b3442f3b.tar.gz bcm5719-llvm-d41059a9f6d04d3314636f6da524ba74b3442f3b.zip |
[ARM] Materialise some boolean values to avoid a branch
This patch combines some cases of ARMISD::CMOV for integers that arise in comparisons of the form
a != b ? x : 0
a == b ? 0 : x
and that currently (e.g. in Thumb1) are emitted as branches.
Differential Revision: https://reviews.llvm.org/D34515
llvm-svn: 325323
Diffstat (limited to 'llvm/test/CodeGen/Thumb2/float-cmp.ll')
-rw-r--r-- | llvm/test/CodeGen/Thumb2/float-cmp.ll | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/test/CodeGen/Thumb2/float-cmp.ll b/llvm/test/CodeGen/Thumb2/float-cmp.ll index 834812cddd6..87d6ad36531 100644 --- a/llvm/test/CodeGen/Thumb2/float-cmp.ll +++ b/llvm/test/CodeGen/Thumb2/float-cmp.ll @@ -69,7 +69,8 @@ define i1 @cmp_f_ord(float %a, float %b) { ; HARD: movvc r0, #1 %1 = fcmp ord float %a, %b ret i1 %1 -}define i1 @cmp_f_ueq(float %a, float %b) { +} +define i1 @cmp_f_ueq(float %a, float %b) { ; CHECK-LABEL: cmp_f_ueq: ; NONE: bl __aeabi_fcmpeq ; NONE: bl __aeabi_fcmpun @@ -82,8 +83,8 @@ define i1 @cmp_f_ord(float %a, float %b) { define i1 @cmp_f_ugt(float %a, float %b) { ; CHECK-LABEL: cmp_f_ugt: ; NONE: bl __aeabi_fcmple -; NONE: cmp r0, #0 -; NONE-NEXT: it eq +; NONE-NEXT: clz r0, r0 +; NONE-NEXT: lsrs r0, r0, #5 ; HARD: vcmpe.f32 ; HARD: movhi r0, #1 %1 = fcmp ugt float %a, %b @@ -92,8 +93,8 @@ define i1 @cmp_f_ugt(float %a, float %b) { define i1 @cmp_f_uge(float %a, float %b) { ; CHECK-LABEL: cmp_f_uge: ; NONE: bl __aeabi_fcmplt -; NONE: cmp r0, #0 -; NONE-NEXT: it eq +; NONE-NEXT: clz r0, r0 +; NONE-NEXT: lsrs r0, r0, #5 ; HARD: vcmpe.f32 ; HARD: movpl r0, #1 %1 = fcmp uge float %a, %b @@ -102,8 +103,8 @@ define i1 @cmp_f_uge(float %a, float %b) { define i1 @cmp_f_ult(float %a, float %b) { ; CHECK-LABEL: cmp_f_ult: ; NONE: bl __aeabi_fcmpge -; NONE: cmp r0, #0 -; NONE-NEXT: it eq +; NONE-NEXT: clz r0, r0 +; NONE-NEXT: lsrs r0, r0, #5 ; HARD: vcmpe.f32 ; HARD: movlt r0, #1 %1 = fcmp ult float %a, %b @@ -112,8 +113,8 @@ define i1 @cmp_f_ult(float %a, float %b) { define i1 @cmp_f_ule(float %a, float %b) { ; CHECK-LABEL: cmp_f_ule: ; NONE: bl __aeabi_fcmpgt -; NONE: cmp r0, #0 -; NONE-NEXT: it eq +; NONE-NEXT: clz r0, r0 +; NONE-NEXT: lsrs r0, r0, #5 ; HARD: vcmpe.f32 ; HARD: movle r0, #1 %1 = fcmp ule float %a, %b |