29 import java.nio.LongBuffer;
30 import java.nio.ReadOnlyBufferException;
31 import java.util.Arrays;
32 import java.util.Objects;
33 import java.util.function.IntUnaryOperator;
34
35 import jdk.internal.misc.Unsafe;
36 import jdk.internal.vm.annotation.ForceInline;
37 import static jdk.incubator.vector.VectorIntrinsics.*;
38
39 @SuppressWarnings("cast")
40 final class Long512Vector extends LongVector {
41 static final Long512Species SPECIES = new Long512Species();
42
43 static final Long512Vector ZERO = new Long512Vector();
44
45 static final int LENGTH = SPECIES.length();
46
47 // Index vector species
48 private static final IntVector.IntSpecies INDEX_SPEC;
49 static {
50 int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH);
51 Vector.Shape shape = Shape.forBitSize(bitSize);
52 INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, shape);
53 }
54 private final long[] vec; // Don't access directly, use getElements() instead.
55
56 private long[] getElements() {
57 return VectorIntrinsics.maybeRebox(this).vec;
58 }
59
60 Long512Vector() {
61 vec = new long[SPECIES.length()];
62 }
63
64 Long512Vector(long[] v) {
65 vec = v;
66 }
67
68 @Override
69 public int length() { return LENGTH; }
70
71 // Unary operator
72
1443 public int elementSize() {
1444 return Long.SIZE;
1445 }
1446
1447 @Override
1448 @ForceInline
1449 @SuppressWarnings("unchecked")
1450 Class<?> vectorType() {
1451 return Long512Vector.class;
1452 }
1453
1454 @Override
1455 @ForceInline
1456 public Shape shape() {
1457 return Shape.S_512_BIT;
1458 }
1459
1460 @Override
1461 IntVector.IntSpecies indexSpecies() {
1462 return INDEX_SPEC;
1463 }
1464
1465 @Override
1466 Long512Vector op(FOp f) {
1467 long[] res = new long[length()];
1468 for (int i = 0; i < length(); i++) {
1469 res[i] = f.apply(i);
1470 }
1471 return new Long512Vector(res);
1472 }
1473
1474 @Override
1475 Long512Vector op(Mask<Long> o, FOp f) {
1476 long[] res = new long[length()];
1477 boolean[] mbits = ((Long512Mask)o).getBits();
1478 for (int i = 0; i < length(); i++) {
1479 if (mbits[i]) {
1480 res[i] = f.apply(i);
1481 }
1482 }
|
29 import java.nio.LongBuffer;
30 import java.nio.ReadOnlyBufferException;
31 import java.util.Arrays;
32 import java.util.Objects;
33 import java.util.function.IntUnaryOperator;
34
35 import jdk.internal.misc.Unsafe;
36 import jdk.internal.vm.annotation.ForceInline;
37 import static jdk.incubator.vector.VectorIntrinsics.*;
38
39 @SuppressWarnings("cast")
40 final class Long512Vector extends LongVector {
41 static final Long512Species SPECIES = new Long512Species();
42
43 static final Long512Vector ZERO = new Long512Vector();
44
45 static final int LENGTH = SPECIES.length();
46
47 // Index vector species
48 private static final IntVector.IntSpecies INDEX_SPEC;
49 private static final Mask<Integer> INDEX_MASK;
50 static {
51 int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH);
52 Vector.Shape shape = Shape.forBitSize(bitSize);
53 INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, shape);
54 INDEX_MASK = null;
55 }
56 private final long[] vec; // Don't access directly, use getElements() instead.
57
58 private long[] getElements() {
59 return VectorIntrinsics.maybeRebox(this).vec;
60 }
61
62 Long512Vector() {
63 vec = new long[SPECIES.length()];
64 }
65
66 Long512Vector(long[] v) {
67 vec = v;
68 }
69
70 @Override
71 public int length() { return LENGTH; }
72
73 // Unary operator
74
1445 public int elementSize() {
1446 return Long.SIZE;
1447 }
1448
1449 @Override
1450 @ForceInline
1451 @SuppressWarnings("unchecked")
1452 Class<?> vectorType() {
1453 return Long512Vector.class;
1454 }
1455
1456 @Override
1457 @ForceInline
1458 public Shape shape() {
1459 return Shape.S_512_BIT;
1460 }
1461
1462 @Override
1463 IntVector.IntSpecies indexSpecies() {
1464 return INDEX_SPEC;
1465 }
1466
1467 @Override
1468 Mask<Integer> indexMask() {
1469 return INDEX_MASK;
1470 }
1471
1472 @Override
1473 Long512Vector op(FOp f) {
1474 long[] res = new long[length()];
1475 for (int i = 0; i < length(); i++) {
1476 res[i] = f.apply(i);
1477 }
1478 return new Long512Vector(res);
1479 }
1480
1481 @Override
1482 Long512Vector op(Mask<Long> o, FOp f) {
1483 long[] res = new long[length()];
1484 boolean[] mbits = ((Long512Mask)o).getBits();
1485 for (int i = 0; i < length(); i++) {
1486 if (mbits[i]) {
1487 res[i] = f.apply(i);
1488 }
1489 }
|