8386891: AArch64: Implement getAndAddB*, getAndAddS*, getAndSetB*, getAndSetS*#31640
8386891: AArch64: Implement getAndAddB*, getAndAddS*, getAndSetB*, getAndSetS*#31640mikabl-arm wants to merge 1 commit into
Conversation
…tAndSetS* AArch64 C2 is missing match rules for byte- and half-word sized variants of `GetAndAdd` and `GetAndSet` atomic operations. Add AArch64 match rules for: ``` getAndAddB[Acq][NoRes][Const] getAndAddS[Acq][NoRes][Const] getAndSetB[Acq] getAndSetS[Acq] ``` These should lower to the corresponding AArch64 LSE byte/half-word atomic instructions: ``` GetAndAddB* -> LDADDB / LDADDALB GetAndAddS* -> LDADDH / LDADDALH GetAndSetB* -> SWPB / SWPALB GetAndSetS* -> SWPH / SWPALH ``` The patch has passed the following test groups on AArch64: - hotspot:hotspot_all(no vmTestbase stress) - jdk:tier1,:tier2,:tier3 - langtools:tier1 - jcstress with -tb 1d
|
👋 Welcome back mablakatov! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@mikabl-arm 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: |
theRealAph
left a comment
There was a problem hiding this comment.
This looks good and straightforward. I do wonder, though if the non-LSE variants are worth having at all. Also, are the sign-extending variants worth anything? Won't C2 do the sign extension if the signed variants are absent?
No it won't. See 4f56990 for a handful of instances that did not properly sign- or zero-extend results. C2 expects all results of subword types to be properly truncated. See also John's excellent treatise on subword types. |
shipilev
left a comment
There was a problem hiding this comment.
Looks reasonable.
I wish we implement https://bugs.openjdk.org/browse/JDK-8372800 at some point, so that we do not emit extra stores when we do not need them. This is outside the scope of this particular PR, it is just it adds more match rules that fall into the similar trap.
| // 16 bit integer valid for add sub immediate | ||
| operand immSAddSub() | ||
| %{ | ||
| predicate(n->get_int() <= 4095 && n->get_int() >= -4095); |
There was a problem hiding this comment.
Is this the same as operand_valid_for_add_sub_immediate? The AddSub suffix for the operand suggests so. I understand we want to cap the range for S, like we do just above for immBAddSubV, but does 4095 come close to failing operand_valid_for_add_sub_immediate? Not sure what is the clean/robust solution here.
There was a problem hiding this comment.
This predicate is stricter than operand_valid_for_add_sub_immediate. The latter also accepts immediates encodable with the optional 12-bit shift, so it cal allow values outside of the 16-bit range.
Looking at this again, this predicate might actually be too strict: it rejects 16-bit immediates with 12 trailing zero bits, even those would be valid Add/Sub immediate operands.
I believe they are, at least as long as the JVM is expected to support Armv8.0 (or earlier). |
|
The problem is that all this macro expansion scales very badly. If you change the That way, all the callers are just stubs rather than being mega-expanded. |
AArch64 C2 is missing match rules for byte- and half-word sized variants of
GetAndAddandGetAndSetatomic operations.Add AArch64 match rules for:
These should lower to the corresponding AArch64 LSE byte/half-word atomic instructions:
The patch has passed the following test groups on AArch64:
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31640/head:pull/31640$ git checkout pull/31640Update a local copy of the PR:
$ git checkout pull/31640$ git pull https://git.openjdk.org/jdk.git pull/31640/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31640View PR using the GUI difftool:
$ git pr show -t 31640Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31640.diff
Using Webrev
Link to Webrev Comment