[release/8.0-staging] Ensure that AdvSimd.Insert doesn't zero out the upper bits #107091
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.
Backport of #106981 to release/8.0-staging
/cc @tannergooding
Customer Impact
Found via Fuzzlyn: #106079
Developers who are using
AdvSimd.Insert
to insert a constant floating-point value may see incorrect codegen on Arm64.Regression
This bug was introduced in .NET 5 when the API was originally added: #35030
Testing
An explicit regression test was added covering the scenario. Additional manual testing of the patterns that are known to be problematic was completed on an Arm64 device. Similar patterns were also validated on x64 and the code was audited to identify if similar issues could exist.
Risk
Low. Most user code is doing insertions via the cross platform API,
vector.WithElement
instead which uses a different intrinsic (InsertSelectedScalar
) to do the insertion, which does not have this same problem.