Skip to content

[AArch64][GlobalISel] Widen more small vectors. #144311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davemgreen
Copy link
Collaborator

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant