[vector] cleaning up mask operations

Paul Sandoz paul.sandoz at oracle.com
Tue May 22 23:44:40 UTC 2018


While tracking what operations are overloaded or not i noticed this:

#if[intOrFP]
    @Override
    @ForceInline
    public $vectortype$ add(Vector<$Boxtype$,Shapes.$shape$> v, Mask<$Boxtype$, Shapes.$shape$> m) {
        // TODO: use better default impl: bOp(o, m, (i, a, b) -> ($type$)(a + b));
        return blend(add(v), m);
    }

    @Override
    @ForceInline
    public $vectortype$ sub(Vector<$Boxtype$,Shapes.$shape$> v, Mask<$Boxtype$, Shapes.$shape$> m) {
        // TODO: use better default impl: bOp(o, m, (i, a, b) -> ($type$)(a - b));
        return blend(sub(v), m);
    }

    @Override
    @ForceInline
    public $vectortype$ mul(Vector<$Boxtype$,Shapes.$shape$> v, Mask<$Boxtype$, Shapes.$shape$> m) {
        // TODO: use better default impl: bOp(o, m, (i, a, b) -> ($type$)(a * b));
        return blend(mul(v), m);
    }
#end[intOrFP]

Why are these masked operations restricted to int, float, and double? A left over from prior work?

I am guessing now that blend is intrinsic we can leverage that for all mask operations, for now (with a few exceptions related to side-effects we need to handle separately), until we push masks down into the vector intrinsics at some later point.

Thanks,
Paul.


More information about the panama-dev mailing list