OSDN Git Service

[AArch64] Generate rev16/rev32 from bswap + srl when upper bits are known zero.
authorChad Rosier <mcrosier@codeaurora.org>
Thu, 26 May 2016 19:41:33 +0000 (19:41 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Thu, 26 May 2016 19:41:33 +0000 (19:41 +0000)
commit6b9dd0cef16077fd9b7578dda518fa1f96df5814
tree5ef2466511273e8e0e70108deace1c561ba41efc
parentfaf7289db32265bb830bd7cecd97e0ca50cb5af3
[AArch64] Generate rev16/rev32 from bswap + srl when upper bits are known zero.

Canonicalize (srl (bswap i32 x), 16) to (rotr (bswap i32 x), 16), if the high
16-bits of x are zero. Similarly, canonicalize (srl (bswap i64 x), 32) to
(rotr (bswap i64 x), 32), if the high 32-bits of x are zero.

test_rev_w_srl16:            test_rev_w_srl16:
  and w8, w0, #0xffff          and     w8, w0, #0xffff
  rev w8, w8           --->    rev16   w0, w8
  lsr     w0, w8, #16

test_rev_x_srl32:            test_rev_x_srl32:
  rev x8, x8           --->    rev32   x0, x8
  lsr x0, x8, #32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270896 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64ISelLowering.cpp
test/CodeGen/AArch64/arm64-rev.ll