< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template
Print this page
rev 55891 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
@@ -169,11 +169,11 @@
throw new IllegalArgumentException("Vector length this species length differ");
return VectorIntrinsics.cast(
$vectortype$.class,
$type$.class, LENGTH,
- s.boxType(),
+ s.vectorType(),
s.elementType(), LENGTH,
this, s,
(species, vector) -> vector.castDefault(species)
);
}
@@ -307,48 +307,48 @@
@Override
@ForceInline
public $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s) {
Objects.requireNonNull(s);
- if (s.bitSize() == 64 && (s.boxType() == $Type$64Vector.class)) {
+ if (s.bitSize() == 64 && (s.vectorType() == $Type$64Vector.class)) {
return VectorIntrinsics.reinterpret(
$vectortype$.class,
$type$.class, LENGTH,
$Type$64Vector.class,
$type$.class, $Type$64Vector.LENGTH,
this, s,
(species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species)
);
- } else if (s.bitSize() == 128 && (s.boxType() == $Type$128Vector.class)) {
+ } else if (s.bitSize() == 128 && (s.vectorType() == $Type$128Vector.class)) {
return VectorIntrinsics.reinterpret(
$vectortype$.class,
$type$.class, LENGTH,
$Type$128Vector.class,
$type$.class, $Type$128Vector.LENGTH,
this, s,
(species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species)
);
- } else if (s.bitSize() == 256 && (s.boxType() == $Type$256Vector.class)) {
+ } else if (s.bitSize() == 256 && (s.vectorType() == $Type$256Vector.class)) {
return VectorIntrinsics.reinterpret(
$vectortype$.class,
$type$.class, LENGTH,
$Type$256Vector.class,
$type$.class, $Type$256Vector.LENGTH,
this, s,
(species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species)
);
- } else if (s.bitSize() == 512 && (s.boxType() == $Type$512Vector.class)) {
+ } else if (s.bitSize() == 512 && (s.vectorType() == $Type$512Vector.class)) {
return VectorIntrinsics.reinterpret(
$vectortype$.class,
$type$.class, LENGTH,
$Type$512Vector.class,
$type$.class, $Type$512Vector.LENGTH,
this, s,
(species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species)
);
} else if ((s.bitSize() > 0) && (s.bitSize() <= 2048)
- && (s.bitSize() % 128 == 0) && (s.boxType() == $Type$MaxVector.class)) {
+ && (s.bitSize() % 128 == 0) && (s.vectorType() == $Type$MaxVector.class)) {
return VectorIntrinsics.reinterpret(
$vectortype$.class,
$type$.class, LENGTH,
$Type$MaxVector.class,
$type$.class, $Type$MaxVector.LENGTH,
@@ -944,148 +944,203 @@
#end[BITWISE]
#if[byte]
@Override
@ForceInline
- public $vectortype$ shiftL(int s) {
+ public $vectortype$ shiftLeft(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_LSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) (a << (i & 7))));
+ (v, i) -> v.uOp((__, a) -> ($type$) (a << (i & 0x7))));
}
@Override
@ForceInline
- public $vectortype$ shiftL(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftL(s), m);
+ public $vectortype$ shiftLeft(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftLeft(s), m);
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s) {
+ public $vectortype$ shiftLeft(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0x7));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a << (b & 0x7)));
+ }
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_URSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) ((a & 0xFF) >>> (i & 7))));
+ (v, i) -> v.uOp((__, a) -> ($type$) ((a & 0xFF) >>> (i & 0x7))));
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftR(s), m);
+ public $vectortype$ shiftRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftRight(s), m);
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s) {
+ public $vectortype$ shiftRight(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0x7));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a >>> (b & 0x7)));
+ }
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftArithmeticRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_RSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) (a >> (i & 7))));
+ (v, i) -> v.uOp((__, a) -> ($type$) (a >> (i & 0x7))));
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(aShiftR(s), m);
+ public $vectortype$ shiftArithmeticRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftArithmeticRight(s), m);
}
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftArithmeticRight(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0x7));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a >> (b & 0x7)));
+ }
+
#end[byte]
#if[short]
@Override
@ForceInline
- public $vectortype$ shiftL(int s) {
+ public $vectortype$ shiftLeft(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_LSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) (a << (i & 15))));
+ (v, i) -> v.uOp((__, a) -> ($type$) (a << (i & 0xF))));
}
@Override
@ForceInline
- public $vectortype$ shiftL(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftL(s), m);
+ public $vectortype$ shiftLeft(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftLeft(s), m);
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s) {
+ public $vectortype$ shiftLeft(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0xF));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a << (b & 0xF)));
+ }
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_URSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) ((a & 0xFFFF) >>> (i & 15))));
+ (v, i) -> v.uOp((__, a) -> ($type$) ((a & 0xFFFF) >>> (i & 0xF))));
+ }
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftRight(s), m);
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftR(s), m);
+ public $vectortype$ shiftRight(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0xF));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a >>> (b & 0xF)));
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s) {
+ public $vectortype$ shiftArithmeticRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_RSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
- (v, i) -> v.uOp((__, a) -> ($type$) (a >> (i & 15))));
+ (v, i) -> v.uOp((__, a) -> ($type$) (a >> (i & 0xF))));
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(aShiftR(s), m);
+ public $vectortype$ shiftArithmeticRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftArithmeticRight(s), m);
+ }
+
+ @Override
+ @ForceInline
+ public $vectortype$ shiftArithmeticRight(Vector<$Boxtype$> s) {
+ $vectortype$ shiftv = ($vectortype$)s;
+ // As per shift specification for Java, mask the shift count.
+ shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, ($type$) 0xF));
+ return this.bOp(shiftv, (i, a, b) -> ($type$) (a >> (b & 0xF)));
}
#end[short]
#if[intOrLong]
@Override
@ForceInline
- public $vectortype$ shiftL(int s) {
+ public $vectortype$ shiftLeft(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_LSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
(v, i) -> v.uOp((__, a) -> ($type$) (a << i)));
}
@Override
@ForceInline
- public $vectortype$ shiftL(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftL(s), m);
+ public $vectortype$ shiftLeft(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftLeft(s), m);
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s) {
+ public $vectortype$ shiftRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_URSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
(v, i) -> v.uOp((__, a) -> ($type$) (a >>> i)));
}
@Override
@ForceInline
- public $vectortype$ shiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(shiftR(s), m);
+ public $vectortype$ shiftRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftRight(s), m);
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s) {
+ public $vectortype$ shiftArithmeticRight(int s) {
return VectorIntrinsics.broadcastInt(
VECTOR_OP_RSHIFT, $vectortype$.class, $type$.class, LENGTH,
this, s,
(v, i) -> v.uOp((__, a) -> ($type$) (a >> i)));
}
@Override
@ForceInline
- public $vectortype$ aShiftR(int s, VectorMask<$Boxtype$> m) {
- return blend(aShiftR(s), m);
+ public $vectortype$ shiftArithmeticRight(int s, VectorMask<$Boxtype$> m) {
+ return blend(shiftArithmeticRight(s), m);
}
@Override
@ForceInline
- public $vectortype$ shiftL(Vector<$Boxtype$> s) {
+ public $vectortype$ shiftLeft(Vector<$Boxtype$> s) {
$vectortype$ shiftv = ($vectortype$)s;
// As per shift specification for Java, mask the shift count.
shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f}));
return VectorIntrinsics.binaryOp(
VECTOR_OP_LSHIFT, $vectortype$.class, $type$.class, LENGTH,
@@ -1093,11 +1148,11 @@
(v1, v2) -> v1.bOp(v2,(i,a, b) -> ($type$) (a << b)));
}
@Override
@ForceInline
- public $vectortype$ shiftR(Vector<$Boxtype$> s) {
+ public $vectortype$ shiftRight(Vector<$Boxtype$> s) {
$vectortype$ shiftv = ($vectortype$)s;
// As per shift specification for Java, mask the shift count.
shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f}));
return VectorIntrinsics.binaryOp(
VECTOR_OP_URSHIFT, $vectortype$.class, $type$.class, LENGTH,
@@ -1105,11 +1160,11 @@
(v1, v2) -> v1.bOp(v2,(i,a, b) -> ($type$) (a >>> b)));
}
@Override
@ForceInline
- public $vectortype$ aShiftR(Vector<$Boxtype$> s) {
+ public $vectortype$ shiftArithmeticRight(Vector<$Boxtype$> s) {
$vectortype$ shiftv = ($vectortype$)s;
// As per shift specification for Java, mask the shift count.
shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f}));
return VectorIntrinsics.binaryOp(
VECTOR_OP_RSHIFT, $vectortype$.class, $type$.class, LENGTH,
@@ -1137,94 +1192,94 @@
// Type specific horizontal reductions
#if[BITWISE]
@Override
@ForceInline
- public $type$ addAll() {
+ public $type$ addLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_ADD, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp(($type$) 0, (i, a, b) -> ($type$) (a + b)));
}
@Override
@ForceInline
- public $type$ andAll() {
+ public $type$ andLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_AND, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp(($type$) -1, (i, a, b) -> ($type$) (a & b)));
}
@Override
@ForceInline
- public $type$ andAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, ($type$) -1).blend(this, m).andAll();
+ public $type$ andLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, ($type$) -1).blend(this, m).andLanes();
}
@Override
@ForceInline
- public $type$ minAll() {
+ public $type$ minLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MIN, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp($Boxtype$.MAX_VALUE , (i, a, b) -> ($type$) Math.min(a, b)));
}
@Override
@ForceInline
- public $type$ maxAll() {
+ public $type$ maxLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MAX, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp($Boxtype$.MIN_VALUE , (i, a, b) -> ($type$) Math.max(a, b)));
}
@Override
@ForceInline
- public $type$ mulAll() {
+ public $type$ mulLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MUL, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp(($type$) 1, (i, a, b) -> ($type$) (a * b)));
}
@Override
@ForceInline
- public $type$ orAll() {
+ public $type$ orLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_OR, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp(($type$) 0, (i, a, b) -> ($type$) (a | b)));
}
@Override
@ForceInline
- public $type$ orAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).orAll();
+ public $type$ orLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).orLanes();
}
@Override
@ForceInline
- public $type$ xorAll() {
+ public $type$ xorLanes() {
return ($type$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_XOR, $vectortype$.class, $type$.class, LENGTH,
this,
v -> (long) v.rOp(($type$) 0, (i, a, b) -> ($type$) (a ^ b)));
}
@Override
@ForceInline
- public $type$ xorAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).xorAll();
+ public $type$ xorLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).xorLanes();
}
#end[BITWISE]
#if[FP]
@Override
@ForceInline
- public $type$ addAll() {
+ public $type$ addLanes() {
$bitstype$ bits = ($bitstype$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_ADD, $vectortype$.class, $type$.class, LENGTH,
this,
v -> {
$type$ r = v.rOp(($type$) 0, (i, a, b) -> ($type$) (a + b));
@@ -1233,11 +1288,11 @@
return $Type$.$bitstype$BitsTo$Fptype$(bits);
}
@Override
@ForceInline
- public $type$ mulAll() {
+ public $type$ mulLanes() {
$bitstype$ bits = ($bitstype$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MUL, $vectortype$.class, $type$.class, LENGTH,
this,
v -> {
$type$ r = v.rOp(($type$) 1, (i, a, b) -> ($type$) (a * b));
@@ -1246,11 +1301,11 @@
return $Type$.$bitstype$BitsTo$Fptype$(bits);
}
@Override
@ForceInline
- public $type$ minAll() {
+ public $type$ minLanes() {
$bitstype$ bits = ($bitstype$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MIN, $vectortype$.class, $type$.class, LENGTH,
this,
v -> {
$type$ r = v.rOp($Boxtype$.POSITIVE_INFINITY , (i, a, b) -> ($type$) Math.min(a, b));
@@ -1259,11 +1314,11 @@
return $Type$.$bitstype$BitsTo$Fptype$(bits);
}
@Override
@ForceInline
- public $type$ maxAll() {
+ public $type$ maxLanes() {
$bitstype$ bits = ($bitstype$) VectorIntrinsics.reductionCoerced(
VECTOR_OP_MAX, $vectortype$.class, $type$.class, LENGTH,
this,
v -> {
$type$ r = v.rOp($Boxtype$.NEGATIVE_INFINITY, (i, a, b) -> ($type$) Math.max(a, b));
@@ -1274,31 +1329,31 @@
#end[FP]
@Override
@ForceInline
- public $type$ addAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).addAll();
+ public $type$ addLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, ($type$) 0).blend(this, m).addLanes();
}
@Override
@ForceInline
- public $type$ mulAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, ($type$) 1).blend(this, m).mulAll();
+ public $type$ mulLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, ($type$) 1).blend(this, m).mulLanes();
}
@Override
@ForceInline
- public $type$ minAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, $Boxtype$.MAX_VALUE).blend(this, m).minAll();
+ public $type$ minLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, $Boxtype$.MAX_VALUE).blend(this, m).minLanes();
}
@Override
@ForceInline
- public $type$ maxAll(VectorMask<$Boxtype$> m) {
- return $abstractvectortype$.broadcast(SPECIES, $Boxtype$.MIN_VALUE).blend(this, m).maxAll();
+ public $type$ maxLanes(VectorMask<$Boxtype$> m) {
+ return $abstractvectortype$.broadcast(SPECIES, $Boxtype$.MIN_VALUE).blend(this, m).maxLanes();
}
@Override
@ForceInline
public VectorShuffle<$Boxtype$> toShuffle() {
@@ -1567,21 +1622,21 @@
return new $fpvectortype$(res);
}
#end[intOrLong]
@Override
- public $vectortype$ rotateEL(int j) {
+ public $vectortype$ rotateLanesLeft(int j) {
$type$[] vec = getElements();
$type$[] res = new $type$[length()];
for (int i = 0; i < length(); i++){
res[(j + i) % length()] = vec[i];
}
return new $vectortype$(res);
}
@Override
- public $vectortype$ rotateER(int j) {
+ public $vectortype$ rotateLanesRight(int j) {
$type$[] vec = getElements();
$type$[] res = new $type$[length()];
for (int i = 0; i < length(); i++){
int z = i - j;
if(j < 0) {
@@ -1592,21 +1647,21 @@
}
return new $vectortype$(res);
}
@Override
- public $vectortype$ shiftEL(int j) {
+ public $vectortype$ shiftLanesLeft(int j) {
$type$[] vec = getElements();
$type$[] res = new $type$[length()];
for (int i = 0; i < length() - j; i++) {
res[i] = vec[i + j];
}
return new $vectortype$(res);
}
@Override
- public $vectortype$ shiftER(int j) {
+ public $vectortype$ shiftLanesRight(int j) {
$type$[] vec = getElements();
$type$[] res = new $type$[length()];
for (int i = 0; i < length() - j; i++){
res[i + j] = vec[i];
}
< prev index next >