[InstCombine] Recognize another bswap idiom.
authorCharlie Turner <charlie.turner@arm.com>
Thu, 24 Sep 2015 10:24:58 +0000 (10:24 +0000)
committerCharlie Turner <charlie.turner@arm.com>
Thu, 24 Sep 2015 10:24:58 +0000 (10:24 +0000)
commit424da5488131bab44c887a2d8a5680e1ad689de4
treef9d850fccda5d3ed490dbd008ae01f4633ed9772
parentb10121bd9d277ab2483d14e00f49a4fa23b6ba82
[InstCombine] Recognize another bswap idiom.

Summary:
The byte-swap recognizer can now notice that this

```
uint32_t bswap(uint32_t x)
{
  x = (x & 0x0000FFFF) << 16 | (x & 0xFFFF0000) >> 16;
  x = (x & 0x00FF00FF) << 8 | (x & 0xFF00FF00) >> 8;
  return x;
}
```

is a bswap. Fixes PR23863.

Reviewers: nlewycky, hfinkel, hans, jmolloy, rengolin

Subscribers: majnemer, rengolin, llvm-commits

Differential Revision: http://reviews.llvm.org/D12637

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248482 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/bswap.ll