llvm-6502/lib/CodeGen/SelectionDAG
Ahmed Bougacha ec35069525 [CodeGen] Add hook/combine to form vector extloads, enabled on X86.
The combine that forms extloads used to be disabled on vector types,
because "None of the supported targets knows how to perform load and
sign extend on vectors in one instruction."

That's not entirely true, since at least SSE4.1 X86 knows how to do
those sextloads/zextloads (with PMOVS/ZX).
But there are several aspects to getting this right.
First, vector extloads are controlled by a profitability callback.
For instance, on ARM, several instructions have folded extload forms,
so it's not always beneficial to create an extload node (and trying to
match extloads is a whole 'nother can of worms).

The interesting optimization enables folding of s/zextloads to illegal
(splittable) vector types, expanding them into smaller legal extloads.

It's not ideal (it introduces some legalization-like behavior in the
combine) but it's better than the obvious alternative: form illegal
extloads, and later try to split them up.  If you do that, you might
generate extloads that can't be split up, but have a valid ext+load
expansion.  At vector-op legalization time, it's too late to generate
this kind of code, so you end up forced to scalarize. It's better to
just avoid creating egregiously illegal nodes.

This optimization is enabled unconditionally on X86.

Note that the splitting combine is happy with "custom" extloads. As
is, this bypasses the actual custom lowering, and just unrolls the
extload. But from what I've seen, this is still much better than the
current custom lowering, which does some kind of unrolling at the end
anyway (see for instance load_sext_4i8_to_4i64 on SSE2, and the added
FIXME).

Also note that the existing combine that forms extloads is now also
enabled on legal vectors.  This doesn't have a big effect on X86
(because sext+load is usually combined to sext_inreg+aextload).
On ARM it fires on some rare occasions; that's for a separate commit.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-05 18:31:02 +00:00
..
CMakeLists.txt [Statepoints 3/4] Statepoint infrastructure for garbage collection: SelectionDAGBuilder 2014-12-02 18:50:36 +00:00
DAGCombiner.cpp [CodeGen] Add hook/combine to form vector extloads, enabled on X86. 2015-02-05 18:31:02 +00:00
FastISel.cpp Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
FunctionLoweringInfo.cpp Remove dead code for llvm.eh.selector in the old EH model 2015-01-14 18:49:39 +00:00
InstrEmitter.cpp Move DataLayout back to the TargetMachine from TargetSubtargetInfo 2015-01-26 19:03:15 +00:00
InstrEmitter.h Remove the uses of getSubtargetImpl from InstrEmitter and remove 2014-10-09 01:35:29 +00:00
LegalizeDAG.cpp Implement new way of expanding extloads. 2015-01-14 01:35:17 +00:00
LegalizeFloatTypes.cpp Add minnum / maxnum codegen 2014-10-21 23:01:01 +00:00
LegalizeIntegerTypes.cpp Fixed a bug in type legalizer for masked load/store intrinsics. 2015-01-22 12:07:59 +00:00
LegalizeTypes.cpp [PowerPC] Implement readcyclecounter for PPC32 2014-12-02 22:01:00 +00:00
LegalizeTypes.h Fixed a bug in type legalizer for masked load/store intrinsics. 2015-01-22 12:07:59 +00:00
LegalizeTypesGeneric.cpp AA metadata refactoring (introduce AAMDNodes) 2014-07-24 12:16:19 +00:00
LegalizeVectorOps.cpp Fixes a bug in vector load legalization that confused bits and bytes. 2015-02-04 18:54:01 +00:00
LegalizeVectorTypes.cpp Fixed a bug in type legalizer for masked load/store intrinsics. 2015-01-22 12:07:59 +00:00
LLVMBuild.txt
Makefile
ResourcePriorityQueue.cpp Remove unused argument to CreateTargetScheduleState and change 2014-10-09 01:59:35 +00:00
ScheduleDAGFast.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
ScheduleDAGRRList.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
ScheduleDAGSDNodes.cpp Adjust ScheduleDAGSDNodes::RegDefIter for patchpoints 2015-01-14 01:07:03 +00:00
ScheduleDAGSDNodes.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
ScheduleDAGVLIW.cpp Remove more calls to getSubtargetImpl from the schedulers and 2014-10-09 06:28:06 +00:00
SDNodeDbgValue.h constify the getters in SDNodeDbgValue. 2014-10-13 20:43:47 +00:00
SelectionDAG.cpp Add nullptr checks for TargetSelectionDAGInfo in SelectionDAG. 2015-01-28 23:50:40 +00:00
SelectionDAGBuilder.cpp Add a FIXME in SelectionDAGBuilder before an assert that is valid only on X86. 2015-01-27 13:14:35 +00:00
SelectionDAGBuilder.h Factor out a splitSwitchCase() function so that it can be reused. 2015-01-20 08:57:44 +00:00
SelectionDAGDumper.cpp Masked Load / Store Intrinsics - the CodeGen part. 2014-12-04 09:40:44 +00:00
SelectionDAGISel.cpp Revert GCStrategy ownership changes 2015-01-26 18:26:35 +00:00
SelectionDAGPrinter.cpp Revert "Introduce a string_ostream string builder facilty" 2014-06-26 22:52:05 +00:00
StatepointLowering.cpp Revert GCStrategy ownership changes 2015-01-26 18:26:35 +00:00
StatepointLowering.h [Statepoints 3/4] Statepoint infrastructure for garbage collection: SelectionDAGBuilder 2014-12-02 18:50:36 +00:00
TargetLowering.cpp Replace size method call of containers to empty method where appropriate 2015-01-15 11:41:30 +00:00
TargetSelectionDAGInfo.cpp Have TargetSelectionDAGInfo take a DataLayout initializer rather than 2014-06-06 19:04:48 +00:00