RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v26]
Quan Anh Mai
qamai at openjdk.org
Wed Feb 12 11:21:14 UTC 2025
On Sat, 1 Feb 2025 19:27:01 GMT, Johannes Graham <duke at openjdk.org> wrote:
>> C2 does not eliminate XOR nodes with constant arguments. This has a noticeable effect on `Long.expand` with a constant mask, on architectures that don't have instructions equivalent to `PDEP` to be used in an intrinsic.
>>
>> This patch demonstrates a potential fix to the problem, but there might well be better ways to do it.
>
> Johannes Graham has updated the pull request incrementally with one additional commit since the last revision:
>
> add IR tests for long, simplify tests for int
Otherwise LGTM, very nice tests, thanks very much!
src/hotspot/share/opto/addnode.cpp line 1028:
> 1026: if (r0->is_con() && r1->is_con()) {
> 1027: // Constant fold: (c1 ^ c2) -> c3
> 1028: return TypeInt::make( r0->get_con() ^ r1->get_con() );
Format
src/hotspot/share/opto/addnode.cpp line 1056:
> 1054: if (r0->is_con() && r1->is_con()) {
> 1055: // Constant fold: (c1 ^ c2) -> c3
> 1056: return TypeLong::make( r0->get_con() ^ r1->get_con() );
Format here, too.
test/hotspot/jtreg/compiler/c2/irTests/XorINodeIdealizationTests.java line 313:
> 311: }
> 312:
> 313: /*
Please remove these commented out code
-------------
Marked as reviewed by qamai (Committer).
PR Review: https://git.openjdk.org/jdk/pull/23089#pullrequestreview-2611597506
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1952453683
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1952453982
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1952456217
More information about the hotspot-compiler-dev
mailing list