diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2014-11-11 17:36:01 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2014-11-11 17:36:01 +0000 |
commit | 8c2c67e63c016b6708897eb6ca5816af416148bd (patch) | |
tree | 31a3fa2ccc13a91a89448cbca711fccfae7f9587 /llvm/test/CodeGen/ARM | |
parent | 1ecb68d5ce702fcebef4243a9a49c65f6d5ee797 (diff) | |
download | bcm5719-llvm-8c2c67e63c016b6708897eb6ca5816af416148bd.tar.gz bcm5719-llvm-8c2c67e63c016b6708897eb6ca5816af416148bd.zip |
LLVM incorrectly folds xor into select
LLVM replaces the SelectionDAG pattern (xor (set_cc cc x y) 1) with
(set_cc !cc x y), which is only correct when the xor has type i1.
Instead, we should check that the constant operand to the xor is all
ones.
llvm-svn: 221693
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r-- | llvm/test/CodeGen/ARM/select_xform.ll | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/select_xform.ll b/llvm/test/CodeGen/ARM/select_xform.ll index e13504a42a1..850d4cd73d7 100644 --- a/llvm/test/CodeGen/ARM/select_xform.ll +++ b/llvm/test/CodeGen/ARM/select_xform.ll @@ -222,3 +222,20 @@ entry: %add = add i32 %conv, %c ret i32 %add } + +; Do not fold the xor into the select +define i32 @t15(i32 %p1, i32 %p2, i32 %p3) { +entry: +; ARM: cmp r0, #8 +; ARM: mov{{(le|gt)}} [[REG:r[0-9]+]], {{r[0-9]+}} +; ARM: eor r0, [[REG]], #1 + +; T2: cmp r0, #8 +; T2: it [[CC:(le|gt)]] +; T2: mov[[CC]] [[REG:r[0-9]+]], {{r[0-9]+}} +; T2: eor r0, [[REG:r[0-9]+]], #1 + %cmp = icmp sgt i32 %p1, 8 + %a = select i1 %cmp, i32 %p2, i32 %p3 + %xor = xor i32 %a, 1 + ret i32 %xor +} |