[vectorIntrinsics+mask] RFR: 8272100: VectorAPI: modify existing implementation of masked neg and not operation.

Paul Sandoz psandoz at openjdk.java.net
Fri Aug 6 21:24:51 UTC 2021


On Fri, 6 Aug 2021 17:36:26 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> - Masked NEG/NOT operations can be implemented using existing masked operations instead of emitting an explicit vector blend after the operation. 
> - Changes shows around 1.3-1.5X gain when merged with X86 backend changes for masking operations. https://github.com/openjdk/panama-vector/pull/99

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template line 611:

> 609:                 return lanewise(XOR, broadcast(-1), m);
> 610:             } else if (op == NEG) {
> 611:                 return lanewise(NOT, m).lanewise(ADD, broadcast(1), m);

Why not stick to the same pattern is the non-masked `lanewiseTemplate` method?
Suggestion:

            if (op == NOT) {
                return broadcast(-1).lanewise(XOR, this, m);
            } else if (op == NEG) {
                return broadcast(0).lanewise(SUB, this, m);

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

PR: https://git.openjdk.java.net/panama-vector/pull/108


More information about the panama-dev mailing list