diff options
author | James Molloy <james.molloy@arm.com> | 2015-11-11 15:40:40 +0000 |
---|---|---|
committer | James Molloy <james.molloy@arm.com> | 2015-11-11 15:40:40 +0000 |
commit | ce12c92f6695cb687880618692cb8c56063bc423 (patch) | |
tree | a0e8088cb065d06d060ecafff00c2dfc4d7ab744 /llvm/test/CodeGen | |
parent | 32994991ce83a3a0408025c467a1075e9c4a0389 (diff) | |
download | bcm5719-llvm-ce12c92f6695cb687880618692cb8c56063bc423.tar.gz bcm5719-llvm-ce12c92f6695cb687880618692cb8c56063bc423.zip |
[ARM] Combine BFIs together
If we have a chain of BFIs, we may be able to combine several together into one merged BFI. We can do this if the "from" bits from one BFI OR'd with the "from" bits from the other BFI form a contiguous range, and the same with the "to" bits.
llvm-svn: 252740
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/ARM/bfi.ll | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/bfi.ll b/llvm/test/CodeGen/ARM/bfi.ll index 0707838e9ef..7699527420a 100644 --- a/llvm/test/CodeGen/ARM/bfi.ll +++ b/llvm/test/CodeGen/ARM/bfi.ll @@ -108,3 +108,42 @@ define i32 @f9(i32 %x, i32 %y) { %sel = select i1 %cmp, i32 %y2, i32 %or ret i32 %sel } + +define i32 @f10(i32 %x, i32 %y) { +; CHECK-LABEL: f10: +; CHECK: bfi r1, r0, #4, #2 + %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00 + %and = and i32 %x, 4 + %or = or i32 %y2, 32 + %cmp = icmp ne i32 %and, 0 + %sel = select i1 %cmp, i32 %or, i32 %y2 + + %aand = and i32 %x, 2 + %aor = or i32 %sel, 16 + %acmp = icmp ne i32 %aand, 0 + %asel = select i1 %acmp, i32 %aor, i32 %sel + + ret i32 %asel +} + +define i32 @f11(i32 %x, i32 %y) { +; CHECK-LABEL: f11: +; CHECK: bfi r1, r0, #4, #3 + %y2 = and i32 %y, 4294967040 ; 0xFFFFFF00 + %and = and i32 %x, 4 + %or = or i32 %y2, 32 + %cmp = icmp ne i32 %and, 0 + %sel = select i1 %cmp, i32 %or, i32 %y2 + + %aand = and i32 %x, 2 + %aor = or i32 %sel, 16 + %acmp = icmp ne i32 %aand, 0 + %asel = select i1 %acmp, i32 %aor, i32 %sel + + %band = and i32 %x, 8 + %bor = or i32 %asel, 64 + %bcmp = icmp ne i32 %band, 0 + %bsel = select i1 %bcmp, i32 %bor, i32 %asel + + ret i32 %bsel +} |