summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/select_xform.ll
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-03-01 22:51:31 +0000
committerSanjay Patel <spatel@rotateright.com>2017-03-01 22:51:31 +0000
commit7685de201cf2c7ceb299abc19ed026e917a7807f (patch)
treec2720dd875013b5c8ea836443e76f0aab002f111 /test/CodeGen/ARM/select_xform.ll
parent386f13715ae428fa267a9941c9d11f018c71d827 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM/select_xform.ll')
-rw-r--r--test/CodeGen/ARM/select_xform.ll12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/CodeGen/ARM/select_xform.ll b/test/CodeGen/ARM/select_xform.ll
index 8c1502e1465..09e8ed4bc09 100644
--- a/test/CodeGen/ARM/select_xform.ll
+++ b/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