Class VectorOperators
java.lang.Object
jdk.incubator.vector.VectorOperators
This class consists solely of static constants
that describe lane-wise vector operations, plus nested interfaces
which classify them.
The static constants serve as tokens denoting specifically
requested lane operations in vector expressions, such
as the token
ADD in
w = v0.lanewise(ADD, v1).
The documentation for each individual operator token is very brief, giving a symbolic Java expression for the operation that the token requests. Those symbolic expressions use the following conventional elements:
a,b,c— names of lane values- Java operators like
+,?:, etc. — expression operators - Java method names like
max,sin, etc. — methods in standard classes likeMath,Double, etc. Unqualified method names should be read as if in the context of a static import, and with resolution of overloading. bits(x)— a function call which produces the underlying bits of the valuex. Ifxis a floating point value, this is eitherdoubleToLongBits(x)orfloatToIntBits(x). Otherwise, the value is justx.ESIZE— the size in bytes of the operand typeEMASK— the bit mask of the operand type, whereEMASK=(1<<(ESIZE*8))-1intVal,byteVal, etc. — the operand of a conversion, with the indicated type
Operations on floating point vectors
- Lane-wise vector operations that apply to floating point vectors
follow the accuracy and monotonicity specifications of the equivalent
Java operation or method mentioned in its documentation unless specified otherwise.
If the vector element type is
floatand the Java operation or method only accepts and returnsdoublevalues, then the scalar operation on each lane is adapted to cast operands and the result, specifically wideningfloatoperands todoubleoperands and narrowing thedoubleresult to afloat. - Certain associative operations that apply to floating point
vectors are not truly associative on the floating point lane values.
Specifically,
ADDandMULused with cross-lane reduction operations, such asFloatVector.reduceLanes(Associative). The result of such an operation is a function both of the input values (vector and mask) as well as the order of the scalar operations applied to combine lane values. In such cases the order is intentionally not defined. This allows the JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to add or multiply all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation is applied, which adds vector elements sequentially from beginning to end. For this reason, the result of such an operation may vary for the same input values.
Note that a particular operator token may apply to several
different lane types. Thus, these tokens behave like overloaded
operators or methods, not like type-specific method handles or
lambdas. Also unlike method handles or lambdas, these operators do
not possess operational semantics; they have no apply or
invoke method. They are used only to request lane
operations from vector objects, and cannot (by themselves) perform
operations on individual lane values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceType for all reassociating lane-wise binary operators, usable in expressions likee = v0.reduceLanes(ADD).static interfacestatic interfacestatic interfacestatic interfaceRoot type for all operator tokens, providing queries for common properties such as arity, argument and return types, symbolic name, and operator name.static interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final VectorOperators.UnaryProduceabs(a).static final VectorOperators.UnaryProduceacos(a).static final VectorOperators.AssociativeProducea+b.static final VectorOperators.AssociativeProducea&b.static final VectorOperators.BinaryProducea&~b.static final VectorOperators.BinaryProducea>>(n&(ESIZE*8-1)).static final VectorOperators.UnaryProduceasin(a).static final VectorOperators.UnaryProduceatan(a).static final VectorOperators.BinaryProduceatan2(a,b).static final VectorOperators.Conversion<Byte, Double> ConvertbyteValto(double)byteVal.static final VectorOperators.Conversion<Byte, Float> ConvertbyteValto(float)byteVal.static final VectorOperators.Conversion<Byte, Integer> ConvertbyteValto(int)byteVal.static final VectorOperators.Conversion<Byte, Long> ConvertbyteValto(long)byteVal.static final VectorOperators.Conversion<Byte, Short> ConvertbyteValto(short)byteVal.static final VectorOperators.UnaryProducebitCount(a)static final VectorOperators.TernaryProducea^((a^b)&c).static final VectorOperators.UnaryProducecbrt(a).static final VectorOperators.BinaryProducecompress(a,n).static final VectorOperators.UnaryProducecos(a).static final VectorOperators.UnaryProducecosh(a).static final VectorOperators.Conversion<Double, Byte> ConvertdoubleValto(byte)doubleVal.static final VectorOperators.Conversion<Double, Float> ConvertdoubleValto(float)doubleVal.static final VectorOperators.Conversion<Double, Integer> ConvertdoubleValto(int)doubleVal.static final VectorOperators.Conversion<Double, Long> ConvertdoubleValto(long)doubleVal.static final VectorOperators.Conversion<Double, Short> ConvertdoubleValto(short)doubleVal.static final VectorOperators.BinaryProducea/b.static final VectorOperators.ComparisonComparea==b.static final VectorOperators.UnaryProduceexp(a).static final VectorOperators.BinaryProduceexpand(a,n).static final VectorOperators.UnaryProduceexpm1(a).static final VectorOperators.Conversion<Float, Byte> ConvertfloatValto(byte)floatVal.static final VectorOperators.Conversion<Float, Double> ConvertfloatValto(double)floatVal.static final VectorOperators.Conversion<Float, Integer> ConvertfloatValto(int)floatVal.static final VectorOperators.Conversion<Float, Long> ConvertfloatValto(long)floatVal.static final VectorOperators.Conversion<Float, Short> ConvertfloatValto(short)floatVal.static final VectorOperators.AssociativeProducebits(a)!=0?a:b.static final VectorOperators.TernaryProducefma(a,b,c).static final VectorOperators.ComparisonComparea>=b.static final VectorOperators.ComparisonComparea>b.static final VectorOperators.BinaryProducehypot(a,b).static final VectorOperators.Conversion<Integer, Byte> ConvertintValto(byte)intVal.static final VectorOperators.Conversion<Integer, Double> ConvertintValto(double)intVal.static final VectorOperators.Conversion<Integer, Float> ConvertintValto(float)intVal.static final VectorOperators.Conversion<Integer, Long> ConvertintValto(long)intVal.static final VectorOperators.Conversion<Integer, Short> ConvertintValto(short)intVal.static final VectorOperators.TestTestbits(a)==0.static final VectorOperators.TestTestisFinite(a).static final VectorOperators.TestTestisInfinite(a).static final VectorOperators.TestTestisNaN(a).static final VectorOperators.TestTestbits(a)<0.static final VectorOperators.Conversion<Long, Byte> ConvertlongValto(byte)longVal.static final VectorOperators.Conversion<Long, Double> ConvertlongValto(double)longVal.static final VectorOperators.Conversion<Long, Float> ConvertlongValto(float)longVal.static final VectorOperators.Conversion<Long, Integer> ConvertlongValto(int)longVal.static final VectorOperators.Conversion<Long, Short> ConvertlongValto(short)longVal.static final VectorOperators.ComparisonComparea<=b.static final VectorOperators.UnaryProducenumberOfLeadingZeros(a)static final VectorOperators.UnaryProducelog(a).static final VectorOperators.UnaryProducelog10(a).static final VectorOperators.UnaryProducelog1p(a).static final VectorOperators.BinaryProducea<<(n&(ESIZE*8-1)).static final VectorOperators.BinaryProduce(a&EMASK)>>>(n&(ESIZE*8-1)).static final VectorOperators.ComparisonComparea<b.static final VectorOperators.AssociativeProducemax(a,b).static final VectorOperators.AssociativeProducemin(a,b).static final VectorOperators.AssociativeProducea*b.static final VectorOperators.ComparisonComparea!=b.static final VectorOperators.UnaryProduce-a.static final VectorOperators.UnaryProduce~a.static final VectorOperators.AssociativeProducea|b.static final VectorOperators.BinaryProducepow(a,b).static final VectorOperators.Conversion<Double, Long> Reinterpret bits ofdoubleValaslong.static final VectorOperators.Conversion<Float, Integer> Reinterpret bits offloatValasint.static final VectorOperators.Conversion<Integer, Float> Reinterpret bits ofintValasfloat.static final VectorOperators.Conversion<Long, Double> Reinterpret bits oflongValasdouble.static final VectorOperators.UnaryProducereverse(a)static final VectorOperators.UnaryProducereverseBytes(a)static final VectorOperators.BinaryProducerotateLeft(a,n).static final VectorOperators.BinaryProducerotateRight(a,n).static final VectorOperators.Conversion<Short, Byte> ConvertshortValto(byte)shortVal.static final VectorOperators.Conversion<Short, Double> ConvertshortValto(double)shortVal.static final VectorOperators.Conversion<Short, Float> ConvertshortValto(float)shortVal.static final VectorOperators.Conversion<Short, Integer> ConvertshortValto(int)shortVal.static final VectorOperators.Conversion<Short, Long> ConvertshortValto(long)shortVal.static final VectorOperators.BinaryProduce saturatinga+b.static final VectorOperators.UnaryProducesin(a).static final VectorOperators.UnaryProducesinh(a).static final VectorOperators.UnaryProducesqrt(a).static final VectorOperators.BinaryProduce saturatinga-b.static final VectorOperators.BinaryProduce saturating unsigneda+b.static final VectorOperators.BinaryProducea-b.static final VectorOperators.BinaryProduce saturating unsigneda-b.static final VectorOperators.UnaryProducetan(a).static final VectorOperators.UnaryProducetanh(a).static final VectorOperators.UnaryProducenumberOfTrailingZeros(a)static final VectorOperators.ComparisonUnsigned comparea>=b.static final VectorOperators.ComparisonUnsigned comparea>b.static final VectorOperators.ComparisonUnsigned comparea<=b.static final VectorOperators.ComparisonUnsigned comparea<b.static final VectorOperators.AssociativeProduce unsignedmax(a,b).static final VectorOperators.AssociativeProduce unsignedmin(a,b).static final VectorOperators.AssociativeProducea^b.static final VectorOperators.Conversion<Byte, Integer> Zero-extendbyteValtoint.static final VectorOperators.Conversion<Byte, Long> Zero-extendbyteValtolong.static final VectorOperators.Conversion<Byte, Short> Zero-extendbyteValtoshort.static final VectorOperators.Conversion<Integer, Long> Zero-extendintValtolong.static final VectorOperators.Conversion<Short, Integer> Zero-extendshortValtoint.static final VectorOperators.Conversion<Short, Long> Zero-extendshortValtolong.static final VectorOperators.UnaryProducea==0?0:-1(zero or minus one). -
Method Summary
-
Field Details
-
NOT
Produce~a. Integral only. -
ZOMO
Producea==0?0:-1(zero or minus one). Integral only. -
ABS
Produceabs(a). -
NEG
Produce-a. -
BIT_COUNT
-
TRAILING_ZEROS_COUNT
ProducenumberOfTrailingZeros(a)- Since:
- 19
-
LEADING_ZEROS_COUNT
ProducenumberOfLeadingZeros(a)- Since:
- 19
-
REVERSE
-
REVERSE_BYTES
-
SIN
Producesin(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
COS
Producecos(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
TAN
Producetan(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
ASIN
Produceasin(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
ACOS
Produceacos(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
ATAN
Produceatan(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
EXP
Produceexp(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
LOG
Producelog(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
LOG10
Producelog10(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
SQRT
Producesqrt(a). Floating only. See section "Operations on floating point vectors" above -
CBRT
Producecbrt(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
SINH
Producesinh(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
COSH
Producecosh(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
TANH
Producetanh(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
EXPM1
Produceexpm1(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
LOG1P
Producelog1p(a). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
ADD
Producea+b. -
SUB
Producea-b. -
MUL
Producea*b. -
DIV
Producea/b. Floating only. -
MIN
Producemin(a,b). -
MAX
Producemax(a,b). -
FIRST_NONZERO
Producebits(a)!=0?a:b. -
AND
Producea&b. Integral only. -
AND_NOT
Producea&~b. Integral only. -
OR
Producea|b. Integral only. -
XOR
Producea^b. Integral only. -
SADD
-
SUADD
Produce saturating unsigneda+b. Integral only.- See Also:
-
SSUB
-
SUSUB
Produce saturating unsigneda-b. Integral only.- See Also:
-
UMIN
Produce unsignedmin(a,b). Integral only.- See Also:
-
UMAX
Produce unsignedmax(a,b). Integral only.- See Also:
-
LSHL
Producea<<(n&(ESIZE*8-1)). Integral only. -
ASHR
Producea>>(n&(ESIZE*8-1)). Integral only. -
LSHR
Produce(a&EMASK)>>>(n&(ESIZE*8-1)). Integral only. -
ROL
ProducerotateLeft(a,n). Integral only. -
ROR
ProducerotateRight(a,n). Integral only. -
COMPRESS_BITS
Producecompress(a,n). Integral,intandlong, only.- Since:
- 19
-
EXPAND_BITS
Produceexpand(a,n). Integral,intandlong, only.- Since:
- 19
-
ATAN2
Produceatan2(a,b). See Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
POW
Producepow(a,b). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
HYPOT
Producehypot(a,b). Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" above -
BITWISE_BLEND
Producea^((a^b)&c). (Bitwise(c(i)?b(i):a(i)).) Integral only. -
FMA
Producefma(a,b,c). Floating only. -
IS_DEFAULT
Testbits(a)==0. (Not true of-0.0.) -
IS_NEGATIVE
Testbits(a)<0. (True of-0.0.) -
IS_FINITE
TestisFinite(a). Floating only. -
IS_NAN
TestisNaN(a). Floating only. -
IS_INFINITE
TestisInfinite(a). Floating only. -
EQ
Comparea==b. -
NE
Comparea!=b. -
LT
Comparea<b. -
LE
Comparea<=b. -
GT
Comparea>b. -
GE
Comparea>=b. -
ULT
-
ULE
-
UGT
-
UGE
-
B2D
ConvertbyteValto(double)byteVal. -
B2F
ConvertbyteValto(float)byteVal. -
B2I
ConvertbyteValto(int)byteVal. -
B2L
ConvertbyteValto(long)byteVal. -
B2S
ConvertbyteValto(short)byteVal. -
D2B
ConvertdoubleValto(byte)doubleVal. -
D2F
ConvertdoubleValto(float)doubleVal. -
D2I
ConvertdoubleValto(int)doubleVal. -
D2L
ConvertdoubleValto(long)doubleVal. -
D2S
ConvertdoubleValto(short)doubleVal. -
F2B
ConvertfloatValto(byte)floatVal. -
F2D
ConvertfloatValto(double)floatVal. -
F2I
ConvertfloatValto(int)floatVal. -
F2L
ConvertfloatValto(long)floatVal. -
F2S
ConvertfloatValto(short)floatVal. -
I2B
ConvertintValto(byte)intVal. -
I2D
ConvertintValto(double)intVal. -
I2F
ConvertintValto(float)intVal. -
I2L
ConvertintValto(long)intVal. -
I2S
ConvertintValto(short)intVal. -
L2B
ConvertlongValto(byte)longVal. -
L2D
ConvertlongValto(double)longVal. -
L2F
ConvertlongValto(float)longVal. -
L2I
ConvertlongValto(int)longVal. -
L2S
ConvertlongValto(short)longVal. -
S2B
ConvertshortValto(byte)shortVal. -
S2D
ConvertshortValto(double)shortVal. -
S2F
ConvertshortValto(float)shortVal. -
S2I
ConvertshortValto(int)shortVal. -
S2L
ConvertshortValto(long)shortVal. -
REINTERPRET_D2L
-
REINTERPRET_F2I
-
REINTERPRET_I2F
-
REINTERPRET_L2D
-
ZERO_EXTEND_B2I
Zero-extendbyteValtoint. -
ZERO_EXTEND_B2L
Zero-extendbyteValtolong. -
ZERO_EXTEND_B2S
Zero-extendbyteValtoshort. -
ZERO_EXTEND_I2L
Zero-extendintValtolong. -
ZERO_EXTEND_S2I
Zero-extendshortValtoint. -
ZERO_EXTEND_S2L
Zero-extendshortValtolong.
-