Teach dag combine to match halfword byteswap patterns.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 21 Jun 2011 06:01:08 +0000 (06:01 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 21 Jun 2011 06:01:08 +0000 (06:01 +0000)
commit9568e5c3c3f1e25288d2ff375dba0fddbf161fd6
tree99a69f068fb095c0e55cf54f82e9c4db93667143
parent2fabd464ae9fd33f068066e3fc3d0caa7ea2279d
Teach dag combine to match halfword byteswap patterns.
1. (((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)
   => (bswap x) >> 16
2. ((x&0xff)<<8)|((x&0xff00)>>8)|((x&0xff000000)>>8)|((x&0x00ff0000)<<8))
   => (rotl (bswap x) 16)

This allows us to eliminate most of the def : Pat patterns for ARM rev16
revsh instructions. It catches many more cases for ARM and x86.

rdar://9609108

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133503 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/ARM/ARMInstrInfo.td
lib/Target/ARM/ARMInstrThumb.td
lib/Target/ARM/ARMInstrThumb2.td
test/CodeGen/ARM/rev.ll
test/CodeGen/X86/bswap.ll