[JDK-8353240] VectorRearrangeTest failures with 64-bit-element 128-bit vectors #11085
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.
Hi,
This one is nasty. For some inexplicable reasons,
vpermilpd
uses the second bit to find which element from the source vector is chosen at each element of the index vector. That is it doesdst[i] = src[idx[i] >> 1]
. To make matters worse, Intel sdm says that:Which is wrong, the control bits are located at bit 1 of each quadword element.
Come back to the Mach 5 test, it looks like this:
So why it only fails with
DeoptimizeALot
? It is because Graal does not vectorize the graph if anyVectorAPINode
is not intrinsifiable. In this case, the normal compilation does not vectorize becauseVectorShuffle::fromArray
is not intrinsifiable. However, when the method deoptimize, because the method is still running, the VM tries to make an OSR compilation starting at the loop head. This vectorizes because the non-intrinfiableVectorShuffle::fromArray
is out of the scope of the OSR compilation.I fix the implementation, it is hard to believe x86 does not have an equivalent of
vpermq
andvpermpd
for 128-bit vectors. We have to shift the index vector left by 1 to performvpermilpd
.Please take a look and leave your reviews, thanks a lot.