[vector] cleaning up mask operations
Lupusoru, Razvan A
razvan.a.lupusoru at intel.com
Tue May 22 23:54:37 UTC 2018
Nice catch - definitely they should not be solely for int or FP. It is due to fact initial implementation of masking only worked for those types but later was extended. You should be able to remove the intOrFP guard and everything should still work :)
Thanks!
--Razvan
-----Original Message-----
From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Paul Sandoz
Sent: Tuesday, May 22, 2018 4:45 PM
To: panama-dev at openjdk.java.net
Subject: [vector] cleaning up mask operations
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