llvm-6502/lib/CodeGen/SelectionDAG
Chandler Carruth f103b3d1b9 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147936 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11 08:41:08 +00:00
..
CMakeLists.txt build/CMake: Finish removal of add_llvm_library_dependencies. 2011-11-29 19:25:30 +00:00
DAGCombiner.cpp Teach the X86 instruction selection to do some heroic transforms to 2012-01-11 08:41:08 +00:00
FastISel.cpp [fast-isel] Remove SelectInsertValue() as fast-isel wasn't designed to handle 2011-12-13 17:45:06 +00:00
FunctionLoweringInfo.cpp An array of chars of length 8 will also cause the stack protector to be inserted 2011-11-02 23:20:58 +00:00
InstrEmitter.cpp Add bundle aware API for querying instruction properties and switch the code 2011-12-07 07:15:52 +00:00
InstrEmitter.h Simplify EXTRACT_SUBREG emission. 2011-10-05 20:26:40 +00:00
LegalizeDAG.cpp Fix a bug in the legalization of shuffle vectors. When we emulate shuffles using BUILD_VECTORS we may be using a BV of different type. Make sure to cast it back. 2012-01-10 14:28:46 +00:00
LegalizeFloatTypes.cpp Added invariant field to the DAG.getLoad method and changed all calls. 2011-11-08 18:42:53 +00:00
LegalizeIntegerTypes.cpp Remove unnecessary default cases in switches that cover all enum values. 2012-01-10 16:47:17 +00:00
LegalizeTypes.cpp Remove unnecessary default cases in switches that cover all enum values. 2012-01-10 16:47:17 +00:00
LegalizeTypes.h 1. Fix the widening of SETCC in WidenVecOp_SETCC. Use the correct return CC type. 2011-10-21 11:42:07 +00:00
LegalizeTypesGeneric.cpp Remove unnecessary default cases in switches that cover all enum values. 2012-01-10 16:47:17 +00:00
LegalizeVectorOps.cpp Initial CodeGen support for CTTZ/CTLZ where a zero input produces an 2011-12-13 01:56:10 +00:00
LegalizeVectorTypes.cpp Remove unnecessary default cases in switches that cover all enum values. 2012-01-10 16:47:17 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile
ScheduleDAGFast.cpp
ScheduleDAGRRList.cpp Make sure we correctly set LiveRegGens when a call is unscheduled. <rdar://problem/10460321>. No testcase because this is very sensitive to scheduling. 2011-12-07 22:24:28 +00:00
ScheduleDAGSDNodes.cpp
ScheduleDAGSDNodes.h
SDNodeDbgValue.h
SDNodeOrdering.h
SelectionDAG.cpp Update DebugLoc while merging nodes at -O0. 2011-12-15 18:21:18 +00:00
SelectionDAGBuilder.cpp Allow vector shuffle normalizing to use concat vector even if the sources are commuted in the shuffle mask. 2012-01-04 09:23:09 +00:00
SelectionDAGBuilder.h Add some constantness to BranchProbabilityInfo and BlockFrequnencyInfo. 2011-12-20 20:03:10 +00:00
SelectionDAGISel.cpp Add comment. 2012-01-06 23:45:47 +00:00
SelectionDAGPrinter.cpp drop unneeded config.h includes 2011-12-22 23:04:07 +00:00
TargetLowering.cpp Add 'llvm_unreachable' to passify GCC's understanding of the constraints 2012-01-10 18:08:01 +00:00
TargetSelectionDAGInfo.cpp