RFR: 8270366: C2: Add associative rule to add/sub node [v2]
Zhengyu Gu
zgu at openjdk.java.net
Wed Jul 14 14:04:41 UTC 2021
> 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)
Zhengyu Gu has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Missing case pointed out by Andrew Dinn
- Merge branch 'master' into JDK-8270366-associative
- sub
- add
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/4765/files
- new: https://git.openjdk.java.net/jdk/pull/4765/files/3bd7e3bc..83209be7
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4765&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4765&range=00-01
Stats: 4459 lines in 262 files changed: 2627 ins; 1061 del; 771 mod
Patch: https://git.openjdk.java.net/jdk/pull/4765.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/4765/head:pull/4765
PR: https://git.openjdk.java.net/jdk/pull/4765
More information about the hotspot-compiler-dev
mailing list