41
42 // -- This file was mechanically generated: Do not edit! -- //
43
44 @SuppressWarnings("cast") // warning: redundant cast
45 final class Float256Vector extends FloatVector {
46 static final FloatSpecies VSPECIES =
47 (FloatSpecies) FloatVector.SPECIES_256;
48
49 static final VectorShape VSHAPE =
50 VSPECIES.vectorShape();
51
52 static final Class<Float256Vector> VCLASS = Float256Vector.class;
53
54 static final int VSIZE = VSPECIES.vectorBitSize();
55
56 static final int VLENGTH = VSPECIES.laneCount();
57
58 static final Class<Float> ETYPE = float.class;
59
60 // The JVM expects to find the state here.
61 private final float[] vec; // Don't access directly, use getElements() instead.
62
63 Float256Vector(float[] v) {
64 vec = v;
65 }
66
67 // For compatibility as Float256Vector::new,
68 // stored into species.vectorFactory.
69 Float256Vector(Object v) {
70 this((float[]) v);
71 }
72
73 static final Float256Vector ZERO = new Float256Vector(new float[VLENGTH]);
74 static final Float256Vector IOTA = new Float256Vector(VSPECIES.iotaArray());
75
76 static {
77 // Warm up a few species caches.
78 // If we do this too much we will
79 // get NPEs from bootstrap circularity.
80 VSPECIES.dummyVector();
81 VSPECIES.withLanes(LaneType.BYTE);
102
103 @ForceInline
104 @Override
105 public final VectorShape shape() { return VSHAPE; }
106
107 @ForceInline
108 @Override
109 public final int length() { return VLENGTH; }
110
111 @ForceInline
112 @Override
113 public final int bitSize() { return VSIZE; }
114
115 @ForceInline
116 @Override
117 public final int byteSize() { return VSIZE / Byte.SIZE; }
118
119 /*package-private*/
120 @ForceInline
121 final @Override
122 float[] getElements() {
123 return VectorIntrinsics.maybeRebox(this).vec;
124 }
125
126 // Virtualized constructors
127
128 @Override
129 @ForceInline
130 public final Float256Vector broadcast(float e) {
131 return (Float256Vector) super.broadcastTemplate(e); // specialize
132 }
133
134 @Override
135 @ForceInline
136 public final Float256Vector broadcast(long e) {
137 return (Float256Vector) super.broadcastTemplate(e); // specialize
138 }
139
140 @Override
141 @ForceInline
142 Float256Mask maskFromArray(boolean[] bits) {
455
456 @Override
457 @ForceInline
458 public Float256Vector selectFrom(Vector<Float> v,
459 VectorMask<Float> m) {
460 return (Float256Vector)
461 super.selectFromTemplate((Float256Vector) v,
462 (Float256Mask) m); // specialize
463 }
464
465
466 @Override
467 public float lane(int i) {
468 if (i < 0 || i >= VLENGTH) {
469 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
470 }
471 int bits = (int) VectorIntrinsics.extract(
472 VCLASS, ETYPE, VLENGTH,
473 this, i,
474 (vec, ix) -> {
475 float[] vecarr = vec.getElements();
476 return (long)Float.floatToIntBits(vecarr[ix]);
477 });
478 return Float.intBitsToFloat(bits);
479 }
480
481 @Override
482 public Float256Vector withLane(int i, float e) {
483 if (i < 0 || i >= VLENGTH) {
484 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
485 }
486 return VectorIntrinsics.insert(
487 VCLASS, ETYPE, VLENGTH,
488 this, i, (long)Float.floatToIntBits(e),
489 (v, ix, bits) -> {
490 float[] res = v.getElements().clone();
491 res[ix] = Float.intBitsToFloat((int)bits);
492 return v.vectorFactory(res);
493 });
494 }
495
496 // Mask
497
498 static final class Float256Mask extends AbstractMask<Float> {
499
500 private final boolean[] bits; // Don't access directly, use getBits() instead.
501
502 public Float256Mask(boolean[] bits) {
503 this(bits, 0);
504 }
505
506 public Float256Mask(boolean[] bits, int offset) {
507 boolean[] a = new boolean[vspecies().laneCount()];
508 for (int i = 0; i < a.length; i++) {
509 a[i] = bits[offset + i];
510 }
|
41
42 // -- This file was mechanically generated: Do not edit! -- //
43
44 @SuppressWarnings("cast") // warning: redundant cast
45 final class Float256Vector extends FloatVector {
46 static final FloatSpecies VSPECIES =
47 (FloatSpecies) FloatVector.SPECIES_256;
48
49 static final VectorShape VSHAPE =
50 VSPECIES.vectorShape();
51
52 static final Class<Float256Vector> VCLASS = Float256Vector.class;
53
54 static final int VSIZE = VSPECIES.vectorBitSize();
55
56 static final int VLENGTH = VSPECIES.laneCount();
57
58 static final Class<Float> ETYPE = float.class;
59
60 // The JVM expects to find the state here.
61 private final float[] vec; // Don't access directly, use vec() instead.
62
63 Float256Vector(float[] v) {
64 vec = v;
65 }
66
67 // For compatibility as Float256Vector::new,
68 // stored into species.vectorFactory.
69 Float256Vector(Object v) {
70 this((float[]) v);
71 }
72
73 static final Float256Vector ZERO = new Float256Vector(new float[VLENGTH]);
74 static final Float256Vector IOTA = new Float256Vector(VSPECIES.iotaArray());
75
76 static {
77 // Warm up a few species caches.
78 // If we do this too much we will
79 // get NPEs from bootstrap circularity.
80 VSPECIES.dummyVector();
81 VSPECIES.withLanes(LaneType.BYTE);
102
103 @ForceInline
104 @Override
105 public final VectorShape shape() { return VSHAPE; }
106
107 @ForceInline
108 @Override
109 public final int length() { return VLENGTH; }
110
111 @ForceInline
112 @Override
113 public final int bitSize() { return VSIZE; }
114
115 @ForceInline
116 @Override
117 public final int byteSize() { return VSIZE / Byte.SIZE; }
118
119 /*package-private*/
120 @ForceInline
121 final @Override
122 float[] vec() {
123 return VectorIntrinsics.maybeRebox(this).vec;
124 }
125
126 // Virtualized constructors
127
128 @Override
129 @ForceInline
130 public final Float256Vector broadcast(float e) {
131 return (Float256Vector) super.broadcastTemplate(e); // specialize
132 }
133
134 @Override
135 @ForceInline
136 public final Float256Vector broadcast(long e) {
137 return (Float256Vector) super.broadcastTemplate(e); // specialize
138 }
139
140 @Override
141 @ForceInline
142 Float256Mask maskFromArray(boolean[] bits) {
455
456 @Override
457 @ForceInline
458 public Float256Vector selectFrom(Vector<Float> v,
459 VectorMask<Float> m) {
460 return (Float256Vector)
461 super.selectFromTemplate((Float256Vector) v,
462 (Float256Mask) m); // specialize
463 }
464
465
466 @Override
467 public float lane(int i) {
468 if (i < 0 || i >= VLENGTH) {
469 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
470 }
471 int bits = (int) VectorIntrinsics.extract(
472 VCLASS, ETYPE, VLENGTH,
473 this, i,
474 (vec, ix) -> {
475 float[] vecarr = vec.vec();
476 return (long)Float.floatToIntBits(vecarr[ix]);
477 });
478 return Float.intBitsToFloat(bits);
479 }
480
481 @Override
482 public Float256Vector withLane(int i, float e) {
483 if (i < 0 || i >= VLENGTH) {
484 throw new IllegalArgumentException("Index " + i + " must be zero or positive, and less than " + VLENGTH);
485 }
486 return VectorIntrinsics.insert(
487 VCLASS, ETYPE, VLENGTH,
488 this, i, (long)Float.floatToIntBits(e),
489 (v, ix, bits) -> {
490 float[] res = v.vec().clone();
491 res[ix] = Float.intBitsToFloat((int)bits);
492 return v.vectorFactory(res);
493 });
494 }
495
496 // Mask
497
498 static final class Float256Mask extends AbstractMask<Float> {
499
500 private final boolean[] bits; // Don't access directly, use getBits() instead.
501
502 public Float256Mask(boolean[] bits) {
503 this(bits, 0);
504 }
505
506 public Float256Mask(boolean[] bits, int offset) {
507 boolean[] a = new boolean[vspecies().laneCount()];
508 for (int i = 0; i < a.length; i++) {
509 a[i] = bits[offset + i];
510 }
|