8384963: C2: Incorrect uint constant match mishandles negative values in vectors#31305
8384963: C2: Incorrect uint constant match mishandles negative values in vectors#31305jatin-bhateja wants to merge 2 commits into
Conversation
|
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@jatin-bhateja The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
Webrevs
|
shipilev
left a comment
There was a problem hiding this comment.
I raised this question in the JBS comments, not sure if that is a real problem or not?
"Actually, I think the similar trouble awaits with predicated AND in this case. If predicated mask passes the full 64-bit lane through AND without change, we cannot trust the matchers as well. We probably need to sprinkle is_predicated_vector() checks in these and test them thoroughly."
|
I think we need to disable predicated OPs, as @shipilev mentioned above. |
Hi @shipilev , |
|
Oh, all right, it looks that way. As long as you cannot construct a counter-example :) |
|
@jatin-bhateja Your analysis is correct, but it relies on how I still suggest adding an explicit |
I think there is no harm in adding safety non-predication checks |
JDK-8341137 introduced a C2 pattern matcher (
MulVLNode::has_uint_inputs) that lowersMulVLto x86VPMULUDQwhen both operands are provably representable in uint32, The constant bound was checked with a signed comparison against0xFFFFFFFFL, which trivially accepts any negativejlongconstant (-1L,-2L,Long.MIN_VALUE, ...). Such masks do not clear the upper 32 bits of a lane, so the resultingVPMULUDQreturned incorrect products. Fix: cast the constant tojulongso the bound is evaluated unsigned.Please review and share your feedback.
Best Regards,
Jatin
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31305/head:pull/31305$ git checkout pull/31305Update a local copy of the PR:
$ git checkout pull/31305$ git pull https://git.openjdk.org/jdk.git pull/31305/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31305View PR using the GUI difftool:
$ git pr show -t 31305Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31305.diff
Using Webrev
Link to Webrev Comment