Integrated: 8270366: C2: Add associative rule to add/sub node

Zhengyu Gu zgu at openjdk.java.net
Thu Jul 15 16:44:19 UTC 2021


On Tue, 13 Jul 2021 12:23:27 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> Please review this small patch that add associative rule to add/sub node, that eliminates a multiply instruction.
> 
> e.g.
> 
> private static int assocInt(int a, int b, int c) {
>   return a * c + b * c;
> }
> 
> 
> x86_64:
> Before:
> 
>   0x00007fda1506152c:   imul   %ecx,%esi
>   0x00007fda1506152f:   imul   %ecx,%edx
>   0x00007fda15061532:   mov    %esi,%eax
>   0x00007fda15061534:   add    %edx,%eax                    ;*iadd {reexecute=0 rethrow=0 return_oop=0}
>                                                             ; - TestAssoc::assocInt at 6 (line 9)
> 
> 
> After:
> 
>   0x00007fc1c078d52c:   add    %edx,%esi
>   0x00007fc1c078d52e:   mov    %ecx,%eax
>   0x00007fc1c078d530:   imul   %esi,%eax                    ;*iadd {reexecute=0 rethrow=0 return_oop=0}
>                                                             ; - TestAssoc::assocInt at 6 (line 9)

This pull request has now been integrated.

Changeset: 746fe5dc
Author:    Zhengyu Gu <zgu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/746fe5dc6857f6e0af42ed150665fa26f52b60ee
Stats:     374 lines in 3 files changed: 374 ins; 0 del; 0 mod

8270366: C2: Add associative rule to add/sub node

Reviewed-by: kvn, adinn

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

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


More information about the hotspot-compiler-dev mailing list