Integrated: 8281803: AArch64: Optimize masked vector NOT/AND_NOT for SVE

Xiaohong Gong xgong at openjdk.java.net
Thu Feb 17 05:48:06 UTC 2022


On Wed, 16 Feb 2022 02:21:56 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

> Currently the vector lanewise `NOT` is implemented with `"v.xor(-1)"` and `AND_NOT ` is implemented with `"v1.and(v2.xor(-1))"`. With SVE they can be respectively implemented with `"not/bic"` instructions, and we have already optimized the non-masked operations before (see [1]).
> 
> Consider the SVE also supports the `predicated` `"not/bic"`, we can apply the same optimizations for the masked `NOT/AND_NOT` by adding match rules. So this patch adds the rules for the following optimizations:
> 
> For `NOT `with int type:
> 
>   mov z16.s, #-1
>   eor z18.s, p0/m, z18.s, z16.s  ==>  not z18.s, p0/m, z18.s
> 
> For `AND_NOT `with int type:
> 
>   not z16.d, p7/m, z16.d
>   and z17.s, p0/m, z17.s, z16.s  ==>  bic z17.s, p0/m, z16.s
> 
> Here is the performance gain for the `"NOT/AND_NOT"` benchmarks (see [2][3] for byte type) with SVE 512-bit:
> 
> Benchmark                    Gain
> LongMaxVector.NOTMasked      1.005
> ShortMaxVector.NOTMasked     1.017
> IntMaxVector.NOTMasked       1.022
> ByteMaxVector.NOTMasked      1.023
> LongMaxVector.AND_NOTMasked  1.063
> IntMaxVector.AND_NOTMasked   1.047
> ShortMaxVector.AND_NOTMasked 1.059
> ByteMaxVector.AND_NOTMasked  1.030
> 
> [1] https://github.com/openjdk/jdk/pull/3370
> [2] https://github.com/openjdk/panama-vector/blob/vectorIntrinsics/test/micro/org/openjdk/bench/jdk/incubator/vector/operation/ByteMaxVector.java#L1963
> [3] https://github.com/openjdk/panama-vector/blob/vectorIntrinsics/test/micro/org/openjdk/bench/jdk/incubator/vector/operation/ByteMaxVector.java#L362

This pull request has now been integrated.

Changeset: 1eec16b4
Author:    Xiaohong Gong <xgong at openjdk.org>
Committer: Ningsheng Jian <njian at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/1eec16b47be300e1462528bddf5d0686df3f042c
Stats:     198 lines in 5 files changed: 116 ins; 0 del; 82 mod

8281803: AArch64: Optimize masked vector NOT/AND_NOT for SVE

Reviewed-by: aph, njian

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

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


More information about the hotspot-compiler-dev mailing list