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
. Ifx
is 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))-1
intVal
,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
float
and the Java operation or method only accepts and returnsdouble
values, then the scalar operation on each lane is adapted to cast operands and the result, specifically wideningfloat
operands todouble
operands and narrowing thedouble
result to afloat
. - Certain associative operations that apply to floating point
vectors are not truly associative on the floating point lane values.
Specifically,
ADD
andMUL
used 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
Modifier and TypeClassDescriptionstatic interface
Type for all reassociating lane-wise binary operators, usable in expressions likee = v0.
reduceLanes
(ADD)
.static interface
static interface
static interface
static interface
Root type for all operator tokens, providing queries for common properties such as arity, argument and return types, symbolic name, and operator name.static interface
static interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final VectorOperators.Unary
Produceabs(a)
.static final VectorOperators.Unary
Produceacos(a)
.static final VectorOperators.Associative
Producea+b
.static final VectorOperators.Associative
Producea&b
.static final VectorOperators.Binary
Producea&~b
.static final VectorOperators.Binary
Producea>>(n&(ESIZE*8-1))
.static final VectorOperators.Unary
Produceasin(a)
.static final VectorOperators.Unary
Produceatan(a)
.static final VectorOperators.Binary
Produceatan2(a,b)
.static final VectorOperators.Conversion
<Byte, Double> ConvertbyteVal
to(double)byteVal
.static final VectorOperators.Conversion
<Byte, Float> ConvertbyteVal
to(float)byteVal
.static final VectorOperators.Conversion
<Byte, Integer> ConvertbyteVal
to(int)byteVal
.static final VectorOperators.Conversion
<Byte, Long> ConvertbyteVal
to(long)byteVal
.static final VectorOperators.Conversion
<Byte, Short> ConvertbyteVal
to(short)byteVal
.static final VectorOperators.Unary
ProducebitCount(a)
static final VectorOperators.Ternary
Producea^((a^b)&c)
.static final VectorOperators.Unary
Producecbrt(a)
.static final VectorOperators.Binary
Producecompress(a,n)
.static final VectorOperators.Unary
Producecos(a)
.static final VectorOperators.Unary
Producecosh(a)
.static final VectorOperators.Conversion
<Double, Byte> ConvertdoubleVal
to(byte)doubleVal
.static final VectorOperators.Conversion
<Double, Float> ConvertdoubleVal
to(float)doubleVal
.static final VectorOperators.Conversion
<Double, Integer> ConvertdoubleVal
to(int)doubleVal
.static final VectorOperators.Conversion
<Double, Long> ConvertdoubleVal
to(long)doubleVal
.static final VectorOperators.Conversion
<Double, Short> ConvertdoubleVal
to(short)doubleVal
.static final VectorOperators.Binary
Producea/b
.static final VectorOperators.Comparison
Comparea==b
.static final VectorOperators.Unary
Produceexp(a)
.static final VectorOperators.Binary
Produceexpand(a,n)
.static final VectorOperators.Unary
Produceexpm1(a)
.static final VectorOperators.Conversion
<Float, Byte> ConvertfloatVal
to(byte)floatVal
.static final VectorOperators.Conversion
<Float, Double> ConvertfloatVal
to(double)floatVal
.static final VectorOperators.Conversion
<Float, Integer> ConvertfloatVal
to(int)floatVal
.static final VectorOperators.Conversion
<Float, Long> ConvertfloatVal
to(long)floatVal
.static final VectorOperators.Conversion
<Float, Short> ConvertfloatVal
to(short)floatVal
.static final VectorOperators.Associative
Producebits(a)!=0?a:b
.static final VectorOperators.Ternary
Producefma(a,b,c)
.static final VectorOperators.Comparison
Comparea>=b
.static final VectorOperators.Comparison
Comparea>b
.static final VectorOperators.Binary
Producehypot(a,b)
.static final VectorOperators.Conversion
<Integer, Byte> ConvertintVal
to(byte)intVal
.static final VectorOperators.Conversion
<Integer, Double> ConvertintVal
to(double)intVal
.static final VectorOperators.Conversion
<Integer, Float> ConvertintVal
to(float)intVal
.static final VectorOperators.Conversion
<Integer, Long> ConvertintVal
to(long)intVal
.static final VectorOperators.Conversion
<Integer, Short> ConvertintVal
to(short)intVal
.static final VectorOperators.Test
Testbits(a)==0
.static final VectorOperators.Test
TestisFinite(a)
.static final VectorOperators.Test
TestisInfinite(a)
.static final VectorOperators.Test
TestisNaN(a)
.static final VectorOperators.Test
Testbits(a)<0
.static final VectorOperators.Conversion
<Long, Byte> ConvertlongVal
to(byte)longVal
.static final VectorOperators.Conversion
<Long, Double> ConvertlongVal
to(double)longVal
.static final VectorOperators.Conversion
<Long, Float> ConvertlongVal
to(float)longVal
.static final VectorOperators.Conversion
<Long, Integer> ConvertlongVal
to(int)longVal
.static final VectorOperators.Conversion
<Long, Short> ConvertlongVal
to(short)longVal
.static final VectorOperators.Comparison
Comparea<=b
.static final VectorOperators.Unary
ProducenumberOfLeadingZeros(a)
static final VectorOperators.Unary
Producelog(a)
.static final VectorOperators.Unary
Producelog10(a)
.static final VectorOperators.Unary
Producelog1p(a)
.static final VectorOperators.Binary
Producea<<(n&(ESIZE*8-1))
.static final VectorOperators.Binary
Produce(a&EMASK)>>>(n&(ESIZE*8-1))
.static final VectorOperators.Comparison
Comparea<b
.static final VectorOperators.Associative
Producemax(a,b)
.static final VectorOperators.Associative
Producemin(a,b)
.static final VectorOperators.Associative
Producea*b
.static final VectorOperators.Comparison
Comparea!=b
.static final VectorOperators.Unary
Produce-a
.static final VectorOperators.Unary
Produce~a
.static final VectorOperators.Associative
Producea|b
.static final VectorOperators.Binary
Producepow(a,b)
.static final VectorOperators.Conversion
<Double, Long> Reinterpret bits ofdoubleVal
aslong
.static final VectorOperators.Conversion
<Float, Integer> Reinterpret bits offloatVal
asint
.static final VectorOperators.Conversion
<Integer, Float> Reinterpret bits ofintVal
asfloat
.static final VectorOperators.Conversion
<Long, Double> Reinterpret bits oflongVal
asdouble
.static final VectorOperators.Unary
Producereverse(a)
static final VectorOperators.Unary
ProducereverseBytes(a)
static final VectorOperators.Binary
ProducerotateLeft(a,n)
.static final VectorOperators.Binary
ProducerotateRight(a,n)
.static final VectorOperators.Conversion
<Short, Byte> ConvertshortVal
to(byte)shortVal
.static final VectorOperators.Conversion
<Short, Double> ConvertshortVal
to(double)shortVal
.static final VectorOperators.Conversion
<Short, Float> ConvertshortVal
to(float)shortVal
.static final VectorOperators.Conversion
<Short, Integer> ConvertshortVal
to(int)shortVal
.static final VectorOperators.Conversion
<Short, Long> ConvertshortVal
to(long)shortVal
.static final VectorOperators.Unary
Producesin(a)
.static final VectorOperators.Unary
Producesinh(a)
.static final VectorOperators.Unary
Producesqrt(a)
.static final VectorOperators.Binary
Producea-b
.static final VectorOperators.Unary
Producetan(a)
.static final VectorOperators.Unary
Producetanh(a)
.static final VectorOperators.Unary
ProducenumberOfTrailingZeros(a)
static final VectorOperators.Comparison
Unsigned comparea>=b
.static final VectorOperators.Comparison
Unsigned comparea>b
.static final VectorOperators.Comparison
Unsigned comparea<=b
.static final VectorOperators.Comparison
Unsigned comparea<b
.static final VectorOperators.Associative
Producea^b
.static final VectorOperators.Conversion
<Byte, Integer> Zero-extendbyteVal
toint
.static final VectorOperators.Conversion
<Byte, Long> Zero-extendbyteVal
tolong
.static final VectorOperators.Conversion
<Byte, Short> Zero-extendbyteVal
toshort
.static final VectorOperators.Conversion
<Integer, Long> Zero-extendintVal
tolong
.static final VectorOperators.Conversion
<Short, Integer> Zero-extendshortVal
toint
.static final VectorOperators.Conversion
<Short, Long> Zero-extendshortVal
tolong
.static final VectorOperators.Unary
Producea==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. -
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,int
andlong
, only.- Since:
- 19
-
EXPAND_BITS
Produceexpand(a,n)
. Integral,int
andlong
, 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
. -
UNSIGNED_LT
Unsigned comparea<b
. Integral only.- See Also:
-
UNSIGNED_LE
Unsigned comparea<=b
. Integral only.- See Also:
-
UNSIGNED_GT
Unsigned comparea>b
. Integral only.- See Also:
-
UNSIGNED_GE
Unsigned comparea>=b
. Integral only.- See Also:
-
B2D
ConvertbyteVal
to(double)byteVal
. -
B2F
ConvertbyteVal
to(float)byteVal
. -
B2I
ConvertbyteVal
to(int)byteVal
. -
B2L
ConvertbyteVal
to(long)byteVal
. -
B2S
ConvertbyteVal
to(short)byteVal
. -
D2B
ConvertdoubleVal
to(byte)doubleVal
. -
D2F
ConvertdoubleVal
to(float)doubleVal
. -
D2I
ConvertdoubleVal
to(int)doubleVal
. -
D2L
ConvertdoubleVal
to(long)doubleVal
. -
D2S
ConvertdoubleVal
to(short)doubleVal
. -
F2B
ConvertfloatVal
to(byte)floatVal
. -
F2D
ConvertfloatVal
to(double)floatVal
. -
F2I
ConvertfloatVal
to(int)floatVal
. -
F2L
ConvertfloatVal
to(long)floatVal
. -
F2S
ConvertfloatVal
to(short)floatVal
. -
I2B
ConvertintVal
to(byte)intVal
. -
I2D
ConvertintVal
to(double)intVal
. -
I2F
ConvertintVal
to(float)intVal
. -
I2L
ConvertintVal
to(long)intVal
. -
I2S
ConvertintVal
to(short)intVal
. -
L2B
ConvertlongVal
to(byte)longVal
. -
L2D
ConvertlongVal
to(double)longVal
. -
L2F
ConvertlongVal
to(float)longVal
. -
L2I
ConvertlongVal
to(int)longVal
. -
L2S
ConvertlongVal
to(short)longVal
. -
S2B
ConvertshortVal
to(byte)shortVal
. -
S2D
ConvertshortVal
to(double)shortVal
. -
S2F
ConvertshortVal
to(float)shortVal
. -
S2I
ConvertshortVal
to(int)shortVal
. -
S2L
ConvertshortVal
to(long)shortVal
. -
REINTERPRET_D2L
-
REINTERPRET_F2I
-
REINTERPRET_I2F
-
REINTERPRET_L2D
-
ZERO_EXTEND_B2I
Zero-extendbyteVal
toint
. -
ZERO_EXTEND_B2L
Zero-extendbyteVal
tolong
. -
ZERO_EXTEND_B2S
Zero-extendbyteVal
toshort
. -
ZERO_EXTEND_I2L
Zero-extendintVal
tolong
. -
ZERO_EXTEND_S2I
Zero-extendshortVal
toint
. -
ZERO_EXTEND_S2L
Zero-extendshortVal
tolong
.
-