[AArch64][GlobalISel] Widen more small vectors. #144311
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When dealing with smaller-than-legal vectors (like v3i8) there are two ways to legalizer the type to a larger vector. Non-power-2 vector types are always widened to a power-2 vector size (adding more elements to the end, so to v4i8). From there we have the option to promote to v4i16 or widen to v8i8. In SDAG we would promote integer types and widen fp vectors, which dictates how the argument types are legalized.
In GISel we have the option to pick, but vector operations like shuffle and extract/insert need to opt for one (they can't pick differently at the moment between int and fp). Promote can mean more extends and truncates, although both have advantages and disadvantages.
This patch switches some of the basic integer vector operations (add, sub, mul, and, or, xor) to widen as opposed to promote, which is hopefully a better method going forward and matches more other operations. Some of the legalization still isn't the best, especially where the result is forced to an argument or return type (which comes up more in tests than in real-life), and some will need extra post-legalization combines to improve.