< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java

Print this page

        

@@ -153,11 +153,11 @@
             throw new IllegalArgumentException("Vector length this species length differ");
 
         return VectorIntrinsics.cast(
             ShortMaxVector.class,
             short.class, LENGTH,
-            s.boxType(),
+            s.vectorType(),
             s.elementType(), LENGTH,
             this, s,
             (species, vector) -> vector.castDefault(species)
         );
     }

@@ -291,48 +291,48 @@
 
     @Override
     @ForceInline
     public ShortVector reshape(VectorSpecies<Short> s) {
         Objects.requireNonNull(s);
-        if (s.bitSize() == 64 && (s.boxType() == Short64Vector.class)) {
+        if (s.bitSize() == 64 && (s.vectorType() == Short64Vector.class)) {
             return VectorIntrinsics.reinterpret(
                 ShortMaxVector.class,
                 short.class, LENGTH,
                 Short64Vector.class,
                 short.class, Short64Vector.LENGTH,
                 this, s,
                 (species, vector) -> (ShortVector) vector.defaultReinterpret(species)
             );
-        } else if (s.bitSize() == 128 && (s.boxType() == Short128Vector.class)) {
+        } else if (s.bitSize() == 128 && (s.vectorType() == Short128Vector.class)) {
             return VectorIntrinsics.reinterpret(
                 ShortMaxVector.class,
                 short.class, LENGTH,
                 Short128Vector.class,
                 short.class, Short128Vector.LENGTH,
                 this, s,
                 (species, vector) -> (ShortVector) vector.defaultReinterpret(species)
             );
-        } else if (s.bitSize() == 256 && (s.boxType() == Short256Vector.class)) {
+        } else if (s.bitSize() == 256 && (s.vectorType() == Short256Vector.class)) {
             return VectorIntrinsics.reinterpret(
                 ShortMaxVector.class,
                 short.class, LENGTH,
                 Short256Vector.class,
                 short.class, Short256Vector.LENGTH,
                 this, s,
                 (species, vector) -> (ShortVector) vector.defaultReinterpret(species)
             );
-        } else if (s.bitSize() == 512 && (s.boxType() == Short512Vector.class)) {
+        } else if (s.bitSize() == 512 && (s.vectorType() == Short512Vector.class)) {
             return VectorIntrinsics.reinterpret(
                 ShortMaxVector.class,
                 short.class, LENGTH,
                 Short512Vector.class,
                 short.class, Short512Vector.LENGTH,
                 this, s,
                 (species, vector) -> (ShortVector) vector.defaultReinterpret(species)
             );
         } else if ((s.bitSize() > 0) && (s.bitSize() <= 2048)
-                && (s.bitSize() % 128 == 0) && (s.boxType() == ShortMaxVector.class)) {
+                && (s.bitSize() % 128 == 0) && (s.vectorType() == ShortMaxVector.class)) {
             return VectorIntrinsics.reinterpret(
                 ShortMaxVector.class,
                 short.class, LENGTH,
                 ShortMaxVector.class,
                 short.class, ShortMaxVector.LENGTH,

@@ -655,51 +655,78 @@
         return blend(xor(v), m);
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector shiftL(int s) {
+    public ShortMaxVector shiftLeft(int s) {
         return VectorIntrinsics.broadcastInt(
             VECTOR_OP_LSHIFT, ShortMaxVector.class, short.class, LENGTH,
             this, s,
-            (v, i) -> v.uOp((__, a) -> (short) (a << (i & 15))));
+            (v, i) -> v.uOp((__, a) -> (short) (a << (i & 0xF))));
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector shiftL(int s, VectorMask<Short> m) {
-        return blend(shiftL(s), m);
+    public ShortMaxVector shiftLeft(int s, VectorMask<Short> m) {
+        return blend(shiftLeft(s), m);
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector shiftR(int s) {
+    public ShortMaxVector shiftLeft(Vector<Short> s) {
+        ShortMaxVector shiftv = (ShortMaxVector)s;
+        // As per shift specification for Java, mask the shift count.
+        shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF));
+        return this.bOp(shiftv, (i, a, b) -> (short) (a << (b & 0xF)));
+    }
+
+    @Override
+    @ForceInline
+    public ShortMaxVector shiftRight(int s) {
         return VectorIntrinsics.broadcastInt(
             VECTOR_OP_URSHIFT, ShortMaxVector.class, short.class, LENGTH,
             this, s,
-            (v, i) -> v.uOp((__, a) -> (short) ((a & 0xFFFF) >>> (i & 15))));
+            (v, i) -> v.uOp((__, a) -> (short) ((a & 0xFFFF) >>> (i & 0xF))));
+    }
+
+    @Override
+    @ForceInline
+    public ShortMaxVector shiftRight(int s, VectorMask<Short> m) {
+        return blend(shiftRight(s), m);
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector shiftR(int s, VectorMask<Short> m) {
-        return blend(shiftR(s), m);
+    public ShortMaxVector shiftRight(Vector<Short> s) {
+        ShortMaxVector shiftv = (ShortMaxVector)s;
+        // As per shift specification for Java, mask the shift count.
+        shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF));
+        return this.bOp(shiftv, (i, a, b) -> (short) (a >>> (b & 0xF)));
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector aShiftR(int s) {
+    public ShortMaxVector shiftArithmeticRight(int s) {
         return VectorIntrinsics.broadcastInt(
             VECTOR_OP_RSHIFT, ShortMaxVector.class, short.class, LENGTH,
             this, s,
-            (v, i) -> v.uOp((__, a) -> (short) (a >> (i & 15))));
+            (v, i) -> v.uOp((__, a) -> (short) (a >> (i & 0xF))));
+    }
+
+    @Override
+    @ForceInline
+    public ShortMaxVector shiftArithmeticRight(int s, VectorMask<Short> m) {
+        return blend(shiftArithmeticRight(s), m);
     }
 
     @Override
     @ForceInline
-    public ShortMaxVector aShiftR(int s, VectorMask<Short> m) {
-        return blend(aShiftR(s), m);
+    public ShortMaxVector shiftArithmeticRight(Vector<Short> s) {
+        ShortMaxVector shiftv = (ShortMaxVector)s;
+        // As per shift specification for Java, mask the shift count.
+        shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF));
+        return this.bOp(shiftv, (i, a, b) -> (short) (a >> (b & 0xF)));
     }
     // Ternary operations
 
 
     // Type specific horizontal reductions

@@ -1027,21 +1054,21 @@
     }
 
 
 
     @Override
-    public ShortMaxVector rotateEL(int j) {
+    public ShortMaxVector rotateLanesLeft(int j) {
         short[] vec = getElements();
         short[] res = new short[length()];
         for (int i = 0; i < length(); i++){
             res[(j + i) % length()] = vec[i];
         }
         return new ShortMaxVector(res);
     }
 
     @Override
-    public ShortMaxVector rotateER(int j) {
+    public ShortMaxVector rotateLanesRight(int j) {
         short[] vec = getElements();
         short[] res = new short[length()];
         for (int i = 0; i < length(); i++){
             int z = i - j;
             if(j < 0) {

@@ -1052,21 +1079,21 @@
         }
         return new ShortMaxVector(res);
     }
 
     @Override
-    public ShortMaxVector shiftEL(int j) {
+    public ShortMaxVector shiftLanesLeft(int j) {
         short[] vec = getElements();
         short[] res = new short[length()];
         for (int i = 0; i < length() - j; i++) {
             res[i] = vec[i + j];
         }
         return new ShortMaxVector(res);
     }
 
     @Override
-    public ShortMaxVector shiftER(int j) {
+    public ShortMaxVector shiftLanesRight(int j) {
         short[] vec = getElements();
         short[] res = new short[length()];
         for (int i = 0; i < length() - j; i++){
             res[i + j] = vec[i];
         }
< prev index next >