diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-03-01 22:51:31 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-03-01 22:51:31 +0000 |
commit | 92938657a0c8859d9ca8687da5f489a9d1a7112d (patch) | |
tree | 4cf411f2815ccd7f559488c89521125fb8959c57 /llvm/test/CodeGen/ARM | |
parent | d80b69fa3bbb8571285775798b78c8babd547823 (diff) | |
download | bcm5719-llvm-92938657a0c8859d9ca8687da5f489a9d1a7112d.tar.gz bcm5719-llvm-92938657a0c8859d9ca8687da5f489a9d1a7112d.zip |
[DAGCombiner] fold binops with constant into select-of-constants
This is part of the ongoing attempt to improve select codegen for all targets and select
canonicalization in IR (see D24480 for more background). The transform is a subset of what
is done in InstCombine's FoldOpIntoSelect().
I first noticed a regression in the x86 avx512-insert-extract.ll tests with a patch that
hopes to convert more selects to basic math ops. This appears to be a general missing DAG
transform though, so I added tests for all standard binops in rL296621
(PowerPC was chosen semi-randomly; it has scripted FileCheck support, but so do ARM and x86).
The poor output for "sel_constants_shl_constant" is tracked with:
https://bugs.llvm.org/show_bug.cgi?id=32105
Differential Revision: https://reviews.llvm.org/D30502
llvm-svn: 296699
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r-- | llvm/test/CodeGen/ARM/select_xform.ll | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/test/CodeGen/ARM/select_xform.ll b/llvm/test/CodeGen/ARM/select_xform.ll index 8c1502e1465..09e8ed4bc09 100644 --- a/llvm/test/CodeGen/ARM/select_xform.ll +++ b/llvm/test/CodeGen/ARM/select_xform.ll @@ -223,21 +223,19 @@ entry: ret i32 %add } -; Do not fold the xor into the select +; Fold the xor into the select. define i32 @t15(i32 %p) { entry: ; ARM-LABEL: t15: -; ARM: mov [[REG:r[0-9]+]], #2 +; ARM: mov [[REG:r[0-9]+]], #3 ; ARM: cmp r0, #8 -; ARM: movwgt [[REG:r[0-9]+]], #1 -; ARM: eor r0, [[REG:r[0-9]+]], #1 +; ARM: movwgt [[REG:r[0-9]+]], #0 ; T2-LABEL: t15: -; T2: movs [[REG:r[0-9]+]], #2 +; T2: movs [[REG:r[0-9]+]], #3 ; T2: cmp [[REG:r[0-9]+]], #8 ; T2: it gt -; T2: movgt [[REG:r[0-9]+]], #1 -; T2: eor r0, [[REG:r[0-9]+]], #1 +; T2: movgt [[REG:r[0-9]+]], #0 %cmp = icmp sgt i32 %p, 8 %a = select i1 %cmp, i32 1, i32 2 %xor = xor i32 %a, 1 |