RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v4]
Quan Anh Mai
qamai at openjdk.org
Thu Jan 23 08:56:54 UTC 2025
On Wed, 22 Jan 2025 20:23:02 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:
>
> fix test names
src/hotspot/share/opto/addnode.cpp line 1003:
> 1001: (r0->_hi > 0) &&
> 1002: (r1->_lo >= 0) &&
> 1003: (r1->_hi > 0)) {
This can be simplified to:
if (r0->_lo >= 0 && r1->_lo >= 0)
There is no need to check `_hi` here.
src/hotspot/share/opto/addnode.cpp line 1010:
> 1008: }
> 1009:
> 1010: // Complementing a boolean?
This is subsumed by the more-general check above and can be removed.
test/hotspot/jtreg/compiler/c2/gvn/TestXorInt.java line 1:
> 1: /*
We have `compiler/c2/irTests/XorINodeIdealizationTest.java`, is adding a separate test file necessary?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1926574177
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1926574774
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1926577039
More information about the hotspot-compiler-dev
mailing list