RFR: 8282365: Optimize divideUnsigned and remainderUnsigned for constants [v18]

Emanuel Peter epeter at openjdk.org
Tue Aug 22 17:45:21 UTC 2023


On Tue, 22 Aug 2023 17:13:42 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> @merykitty Why do you need the intrinsic for `Math::min/max(long,long)`? I would just write two methods: one that is compiled (maybe add IR rule that checks that division is present in earlier compile phase, but not present later), and another method that is excluded from compilation. Then you can just generate random inputs to the division and compare outputs.
>> 
>> But sure, adding the intrinsics for long min/max is on my list, because I want it to vectorize with SuperWord. So go ahead with it in a separate RFE if you want to use it for testing.
>
> @eme64 Because the division is transformed before it even appears on the graph, so the most simple solution to have an arbitrary value range for the dividend is to use a pair of min/max nodes to clamp the input and inform the compiler about the value set of the dividend. Thanks.

@merykitty another way to easily get a value range it to use a `Phi` node which merges two constants. Have you tried that?

long x;
if (flag) {
  x = 10;
} else {
  x = 100;
}
// Phi for x should have range long:10..100

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

PR Comment: https://git.openjdk.org/jdk/pull/9947#issuecomment-1688618393


More information about the hotspot-compiler-dev mailing list