summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-01-11 08:41:08 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-01-11 08:41:08 +0000
commit55b2cdee26159b99c77b5a4dc7fc3513dc18436f (patch)
tree8f7d236201538e305a75e3ca5f02110e73ff4bfe /llvm/lib/Target/X86/X86FrameLowering.cpp
parent8216569812e8836d7a0bd11b83a74b972d71702d (diff)
downloadbcm5719-llvm-55b2cdee26159b99c77b5a4dc7fc3513dc18436f.tar.gz
bcm5719-llvm-55b2cdee26159b99c77b5a4dc7fc3513dc18436f.zip
Teach the X86 instruction selection to do some heroic transforms to
detect a pattern which can be implemented with a small 'shl' embedded in the addressing mode scale. This happens in real code as follows: unsigned x = my_accelerator_table[input >> 11]; Here we have some lookup table that we look into using the high bits of 'input'. Each entity in the table is 4-bytes, which means this implicitly gets turned into (once lowered out of a GEP): *(unsigned*)((char*)my_accelerator_table + ((input >> 11) << 2)); The shift right followed by a shift left is canonicalized to a smaller shift right and masking off the low bits. That hides the shift right which x86 has an addressing mode designed to support. We now detect masks of this form, and produce the longer shift right followed by the proper addressing mode. In addition to saving a (rather large) instruction, this also reduces stalls in Intel chips on benchmarks I've measured. In order for all of this to work, one part of the DAG needs to be canonicalized *still further* than it currently is. This involves removing pointless 'trunc' nodes between a zextload and a zext. Without that, we end up generating spurious masks and hiding the pattern. llvm-svn: 147936
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud