RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v7]
Emanuel Peter
epeter at openjdk.org
Mon Jan 27 08:26:53 UTC 2025
On Mon, 27 Jan 2025 08:18:38 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> 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
>
> test/hotspot/jtreg/compiler/c2/irTests/XorLNodeIdealizationTests.java line 39:
>
>> 37: private static final long CONST_1 = RunInfo.getRandom().nextLong();
>> 38: private static final long CONST_2 = RunInfo.getRandom().nextLong();
>> 39: private static final long CONST_POW_2 = Math.abs(1L << RunInfo.getRandom().nextInt());
>
> Can you please use our new `Generators.java`? I'll explain why:
>
> Sampling random powers-of-2, or values near powers-of-2 is very very rare with longs. There are about 64 powers-of-2 in a set of `2^64`, so the odds are really really bad. The sampler in `Generators.java` has a bias to pick more powers-of-2 and values nearby.
And we need values nearby powers of 2, as your examples show ;)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1930125331
More information about the hotspot-compiler-dev
mailing list