This is a port from the DAG legalization. We're still missing some of the canonicalizations of shuffles but it's a start.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4280 | I don't like simply discarding NarrowTy. It would be better to compute the type you do handle, and fail if it doesn't match the requested type | |
4283–4285 | It should be relatively easy to use extractGCDType + buildLCMMergePieces to form a widened vector for the non-power-of-2 case |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4280 | But if you do that, fewerElements isn't going to know which narrow type it supports. Legalizing <16 x s64> is going to use a narrow ty of <2 x s64> with the rules as they're written now. |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4283–4285 | I think for shuffle splitting, we should do what the DAG does here and insist on a power-of-2 size with moreElementsToNextPow2. |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4280 | I don't follow, the parameter tells you which type to use |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4280 | For AArch64, if you have an oversize shuffle like <8 x s64>, fewerElementsVector is called with NarrowTy set to <2 x s64> since that's the type that we support. We can't just error out if in that case since this can be legalized, it just needs to the fewerElementsVector action to be done multiple times until we reach <2 x s64>. |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4280 | The API suggests this should make the full transform all the way to <2 x s64> pieces in one shot |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4283–4285 | IIRC the original intention of the legalizer rewrite was that the legalisation could be done in steps if needed, with the type as a direction to move towards. It also seems cleaner to me to use the existing mechanism to handle further illegal operations than to duplicate that logic twice. |
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | ||
---|---|---|
4283–4285 | Legalization can be done in multiple steps, but I think the fewerElements would be considered one step (e.g. as a further step the scalars could be legalized) |
I don't like simply discarding NarrowTy. It would be better to compute the type you do handle, and fail if it doesn't match the requested type