RFR: 8350988: Consolidate Identity of self-inverse operations [v2]
Hannes Greule
hgreule at openjdk.org
Thu Mar 13 13:19:41 UTC 2025
> subnode has multiple nodes that are self-inverse but lacking the respective optimization. ReverseINode and ReverseLNode already have the optimization, but we can deduplicate the code for all those operations.
>
> For most nodes, the optimization is obvious. The NegF/DNodes however are worth to look at in detail imo:
> - `Float.NaN` has the same bits set as `-Float.NaN`. That means, it this specific case, the operation is a no-op anyway
> - For other values, the msb is flipped, flipping twice results in the original value again.
>
> Similar changes could be made to the corresponding vector nodes. If you want, I can do that in a follow-up RFE.
>
> One note: During benchmarking those changes, I ran into https://bugs.openjdk.org/browse/JDK-8307516. That means code like
>
> int v = 0;
> for (int datum : data) {
> v ^= Integer.reverseBytes(Integer.reverseBytes(datum));
> }
> return v;
>
> was vectorized before but is considered "not profitable" with the changes here, causing slowdowns in such cases.
Hannes Greule has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
- use Generators
- after merge cleanup
- Merge branch 'master' into involution-nodes
- collapse impl, add more fitting nodes
- test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23851/files
- new: https://git.openjdk.org/jdk/pull/23851/files/41c555cd..b82ed237
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23851&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23851&range=00-01
Stats: 65786 lines in 1301 files changed: 29325 ins; 24767 del; 11694 mod
Patch: https://git.openjdk.org/jdk/pull/23851.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23851/head:pull/23851
PR: https://git.openjdk.org/jdk/pull/23851
More information about the hotspot-compiler-dev
mailing list