mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 17:29:19 +00:00
First, don't combine bit masking into vector shuffles (even ones the target can handle) once operation legalization has taken place. Custom legalization of vector shuffles may exist for these patterns (making the predicate return true) but that custom legalization may in some cases produce the exact bit math this matches. We only really want to handle this prior to operation legalization. However, the x86 backend, in a fit of awesome, relied on this. What it would do is mark VSELECTs as expand, which would turn them into arithmetic, which this would then match back into vector shuffles, which we would then lower properly. Amazing. Instead, the second change is to teach the x86 backend to directly form vector shuffles from VSELECT nodes with constant conditions, and to mark all of the vector types we support lowering blends as shuffles as custom VSELECT lowering. We still mark the forms which actually support variable blends as *legal* so that the custom lowering is bypassed, and the legal lowering can even be used by the vector shuffle legalization (yes, i know, this is confusing. but that's how the patterns are written). This makes the VSELECT lowering much more sensible, and in fact should fix a bunch of bugs with it. However, as you'll see in the test cases, right now what it does is point out the *hilarious* deficiency of the new vector shuffle lowering when it comes to blends. Fortunately, my very next patch fixes that. I can't submit it yet, because that patch, somewhat obviously, forms the exact and/or pattern that the DAG combine is matching here! Without this patch, teaching the vector shuffle lowering to produce the right code infloops in the DAG combiner. With this patch alone, we produce terrible code but at least lower through the right paths. With both patches, all the regressions here should be fixed, and a bunch of the improvements (like using 2 shufps with no memory loads instead of 2 andps with memory loads and an orps) will stay. Win! There is one other change worth noting here. We had hilariously wrong vectorization cost estimates for vselect because we fell through to the code path that assumed all "expand" vector operations are scalarized. However, the "expand" lowering of VSELECT is vector bit math, most definitely not scalarized. So now we go back to the correct if horribly naive cost of "1" for "not scalarized". If anyone wants to add actual modeling of shuffle costs, that would be cool, but this seems an improvement on its own. Note the removal of 16 and 32 "costs" for doing a blend. Even in SSE2 we can blend in fewer than 16 instructions. ;] Of course, we don't right now because of OMG bad code, but I'm going to fix that. Next patch. I promise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229835 91177308-0d34-0410-b5e6-96231b3b80d8 |
||
---|---|---|
.. | ||
ADCE | ||
AddDiscriminators | ||
AlignmentFromAssumptions | ||
ArgumentPromotion | ||
AtomicExpand/ARM | ||
BBVectorize | ||
BDCE | ||
BranchFolding | ||
CodeExtractor | ||
CodeGenPrepare | ||
ConstantHoisting | ||
ConstantMerge | ||
ConstProp | ||
CorrelatedValuePropagation | ||
DeadArgElim | ||
DeadStoreElimination | ||
EarlyCSE | ||
FunctionAttrs | ||
GCOVProfiling | ||
GlobalDCE | ||
GlobalOpt | ||
GVN | ||
IndVarSimplify | ||
Inline | ||
InstCombine | ||
InstMerge | ||
InstSimplify | ||
Internalize | ||
IPConstantProp | ||
IRCE | ||
JumpThreading | ||
LCSSA | ||
LICM | ||
LoadCombine | ||
LoopDeletion | ||
LoopIdiom | ||
LoopReroll | ||
LoopRotate | ||
LoopSimplify | ||
LoopStrengthReduce | ||
LoopUnroll | ||
LoopUnswitch | ||
LoopVectorize | ||
LowerAtomic | ||
LowerExpectIntrinsic | ||
LowerInvoke | ||
LowerSwitch | ||
Mem2Reg | ||
MemCpyOpt | ||
MergeFunc | ||
MetaRenamer | ||
ObjCARC | ||
PartiallyInlineLibCalls | ||
PhaseOrdering | ||
PlaceSafepoints | ||
PruneEH | ||
Reassociate | ||
Reg2Mem | ||
SampleProfile | ||
Scalarizer | ||
ScalarRepl | ||
SCCP | ||
SeparateConstOffsetFromGEP/NVPTX | ||
SimplifyCFG | ||
Sink | ||
SLPVectorizer | ||
SROA | ||
StraightLineStrengthReduce | ||
StripSymbols | ||
StructurizeCFG | ||
TailCallElim | ||
TailDup | ||
Util |