RFR: 8273454: C2: Transform (-a)*(-b) into a*b [v4]

Tobias Hartmann thartmann at openjdk.java.net
Tue Sep 14 07:09:06 UTC 2021


On Fri, 10 Sep 2021 12:23:11 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/integerArithmetic/TestNegMultiply.java line 44:
>> 
>>> 42: 
>>> 43:     private static void testInt(int a, int b) {
>>> 44:         int expected = (-a) * (-b);
>> 
>> Are you sure about this is the expected value? As the method has been invoked 2000 times, I think it would be compiled by c2.
>
> The default CompileThreshold is 10K when tiered compilation is disabled, which is the case here, so there is no risk.

But why don't you compute `expected` as `a * b`?

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

PR: https://git.openjdk.java.net/jdk/pull/5403


More information about the hotspot-compiler-dev mailing list