Integrated: 8264109: Add vectorized implementation for VectorMask.andNot()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Integrated: 8264109: Add vectorized implementation for VectorMask.andNot()

Xiaohong Gong
On Fri, 26 Mar 2021 01:50:33 GMT, Xiaohong Gong <[hidden email]> wrote:

> Currently "VectorMask.andNot()" is not vectorized:
>     public VectorMask<E> andNot(VectorMask<E> m) {
>         // FIXME: Generate good code here.
>         return bOp(m, (i, a, b) -> a && !b);
>     }
> This can be implemented with` "and(m.not())" `directly. Since `"VectorMask.and()/not()" `have been vectorized in hotspot, `"andNot"`
> can be vectorized as well by calling them.
>
> The performance gain is >100% for such a simple JMH:
>   @Benchmark
>   public Object andNot(Blackhole bh) {
>     boolean[] mask = fm.apply(SPECIES.length());
>     boolean[] r = fmt.apply(SPECIES.length());
>     VectorMask<Byte> rm = VectorMask.fromArray(SPECIES, r, 0);
>
>     for (int ic = 0; ic < INVOC_COUNT; ic++) {
>       for (int i = 0; i < mask.length; i += SPECIES.length()) {
>         VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, i);
>           rm = rm.andNot(vmask);
>         }
>     }
>     return rm;
>   }

This pull request has now been integrated.

Changeset: 7d0a0bad
Author:    Xiaohong Gong <[hidden email]>
Committer: Ningsheng Jian <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/7d0a0bad
Stats:     3 lines in 1 file changed: 0 ins; 1 del; 2 mod

8264109: Add vectorized implementation for VectorMask.andNot()

Reviewed-by: psandoz, njian

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

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