< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template

Print this page
rev 55589 : 8221817: [vector] No suitable species for indexMap of Gather/Scatter VectorAPI
Reviewed-by: duke

*** 47,63 **** --- 47,80 ---- static final int LENGTH = SPECIES.length(); #if[!byteOrShort] // Index vector species private static final IntVector.IntSpecies INDEX_SPEC; + #if[longOrDouble] + private static final Mask<Integer> INDEX_MASK; + #end[longOrDouble] static { #if[longOrDouble64] INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, Shape.S_64_BIT); + INDEX_MASK = null; #else[longOrDouble64] + #if[longOrDoubleMax] + int bitSize = Vector.bitSizeForVectorLength($type$.class, LENGTH); + #else[longOrDoubleMax] int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH); + #end[longOrDoubleMax] Vector.Shape shape = Shape.forBitSize(bitSize); INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, shape); + #if[longOrDouble] + #if[longOrDoubleMax] + boolean[] mask = new boolean[INDEX_SPEC.length()]; + Arrays.fill(mask, 0, LENGTH, true); + INDEX_MASK = IntVector.maskFromArray(INDEX_SPEC, mask, 0); + #else[longOrDoubleMax] + INDEX_MASK = null; + #end[longOrDoubleMax] + #end[longOrDouble] #end[longOrDouble64] } #end[!byteOrShort] private final $type$[] vec; // Don't access directly, use getElements() instead.
*** 1347,1357 **** --- 1364,1378 ---- #else[longOrDouble64] Objects.requireNonNull(a); Objects.requireNonNull(b); // Index vector: vix[0:n] = i -> ix + indexMap[iy + i] + #if[longOrDoubleMax] + IntVector vix = IntVector.fromArray(INDEX_SPEC, b, iy, INDEX_MASK).add(ix); + #else[longOrDoubleMax] IntVector vix = IntVector.fromArray(INDEX_SPEC, b, iy).add(ix); + #end[longOrDoubleMax] vix = VectorIntrinsics.checkIndex(vix, a.length); VectorIntrinsics.storeWithMap($vectortype$.class, $type$.class, LENGTH, $vectorindextype$, a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
*** 1955,1964 **** --- 1976,1992 ---- @Override IntVector.IntSpecies indexSpecies() { return INDEX_SPEC; } + #if[longOrDouble] + @Override + Mask<Integer> indexMask() { + return INDEX_MASK; + } + + #end[longOrDouble] #end[!byteOrShort] @Override $vectortype$ op(FOp f) { $type$[] res = new $type$[length()]; for (int i = 0; i < length(); i++) {
< prev index next >