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

Xiaohong Gong xgong at openjdk.java.net
Mon Aug 9 07:10:53 UTC 2021


On Fri, 6 Aug 2021 21:22:05 GMT, Paul Sandoz <psandoz 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);

Seems the result is not equal to `this` vector for the non-active lanes (false lane for `m`)?

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

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


More information about the panama-dev mailing list