RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v7]

Johannes Graham duke at openjdk.org
Sat Jan 25 16:56:52 UTC 2025


On Sat, 25 Jan 2025 16:23:00 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 three additional commits since the last revision:
> 
>  - formatting
>  - simplified version of bounds check
>  - tests for xor hi=power of 2

I have added tests specifically for the power of 2 case, and updated `add_ring` to use the simpler logic. I've also added some examples to help clarify it.

After https://github.com/openjdk/jdk/pull/17508, this might lend itself to an even more intuitive solution.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23089#issuecomment-2614028865


More information about the hotspot-compiler-dev mailing list