Integrated: 8308340: C2: Idealize Fma nodes
Fei Gao
fgao at openjdk.org
Tue Aug 15 01:07:25 UTC 2023
On Wed, 21 Jun 2023 03:26:38 GMT, Fei Gao <fgao at openjdk.org> wrote:
> Some platforms, like aarch64, ppc, and riscv, support fusing `Math.fma(-a, b, c)` or `Math.fma(a, -b, c)` by generating partially symmetric match rules like:
>
>
> match(Set dst (FmaF src3 (Binary (NegF src1) src2)));
> match(Set dst (FmaF src3 (Binary src1 (NegF src2))));
>
>
> Since `Fma` is partially commutative, the patch is to convert `Math.fma(-a, b, c)` to `Math.fma(b, -a, c)` in gvn phase, making node patterns canonical. Then we can remove redundant rules.
>
> Also, we should guarantee that C2 generates `Fma` nodes only on platforms supporting `Fma` instructions before matcher, so we can remove all `predicate(UseFMA)` for all `Fma` rules.
>
> After the patch, the code size of libjvm.so on aarch64 platform decreased by 63.4k.
>
> The patch passed all tier 1 - 3 on aarch64 and x86 platforms.
This pull request has now been integrated.
Changeset: 37c6b23f
Author: Fei Gao <fgao at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/37c6b23f5b82311c82f5fe981f104824f87e3e54
Stats: 689 lines in 20 files changed: 469 ins; 118 del; 102 mod
8308340: C2: Idealize Fma nodes
Reviewed-by: kvn, epeter
-------------
PR: https://git.openjdk.org/jdk/pull/14576
More information about the hotspot-compiler-dev
mailing list