summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2015-11-12 13:49:17 +0000
committerJames Molloy <james.molloy@arm.com>2015-11-12 13:49:17 +0000
commit8e99e97f2a9f174258dc738cb151da6444cbb693 (patch)
treef306777c8fef2b65b233198f04e8b41151064b65 /llvm/test/CodeGen
parent19a17c3a163118ee8877701aea9e1b059b7aa227 (diff)
downloadbcm5719-llvm-8e99e97f2a9f174258dc738cb151da6444cbb693.tar.gz
bcm5719-llvm-8e99e97f2a9f174258dc738cb151da6444cbb693.zip
[ARM] CMOV->BFI combining: handle both senses of CMPZ
I completely misunderstood what ARMISD::CMPZ means. It's not "compare equal to zero", it's "compare, only setting the zero/Z flag". It can either be equal-to-zero or not-equal-to-zero, and we weren't checking what sense it was. If it's equal-to-zero, we can swap the operands around and pretend like it is not-equal-to-zero, which is both a bug fix and lets us handle more cases. llvm-svn: 252891
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/ARM/bfi.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/bfi.ll b/llvm/test/CodeGen/ARM/bfi.ll
index 7699527420a..39bcbf2cfec 100644
--- a/llvm/test/CodeGen/ARM/bfi.ll
+++ b/llvm/test/CodeGen/ARM/bfi.ll
@@ -147,3 +147,14 @@ define i32 @f11(i32 %x, i32 %y) {
ret i32 %bsel
}
+
+define i32 @f12(i32 %x, i32 %y) {
+; CHECK-LABEL: f12:
+; CHECK: bfi r1, r0, #4, #1
+ %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00
+ %and = and i32 %x, 4
+ %or = or i32 %y2, 16
+ %cmp = icmp eq i32 %and, 0
+ %sel = select i1 %cmp, i32 %y2, i32 %or
+ ret i32 %sel
+}
OpenPOWER on IntegriCloud