RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v6]
Johannes Graham
duke at openjdk.org
Thu Jan 23 23:38:46 UTC 2025
On Thu, 23 Jan 2025 17:40:09 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 two additional commits since the last revision:
>
> - move tests to Xor*NodeIdealizationTests
> - remove redundant boolean check
Remaining issues are
- do we keep the original code that calculates the the bounds, or substitute something that looks easier to explain.
- do we omit the check for r0->_hi and r1->_h1 being > 0. Without it r0=(0,0) and r1=(0,1) , gets past the check that both are constant with r0->_hi equal to zero. In the original code this would cause a problem - except that 0^x should have been simplified already, so it would be prevented. But that code is a little further away, so not immediately clear.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23089#issuecomment-2611229591
More information about the hotspot-compiler-dev
mailing list