< prev index next >

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

Print this page

        

@@ -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,

@@ -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 >