Details
-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
generic
-
generic
Description
ADDITIONAL SYSTEM INFORMATION :
Ubuntu 22.04.2 LTS
openjdk version "20-internal" 2023-03-21
OpenJDK Runtime Environment (build 20-internal-adhoc.admin1.jdk-jdk-20-34)
OpenJDK 64-Bit Server VM (build 20-internal-adhoc.admin1.jdk-jdk-20-34, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The IntVector class (and also the FloatVector class) have redundant functions which seem to have the same behavior. The viewAsFloatingLanes() and the reinterpretAsFloats() functions do the same thing as illustrated in the attached example. The reason for this might be that these functions behave differently for vectors of different data types (when the bit size is different for the conversion), and they were just taken over into the IntVector class. To avoid confusion, it would be good to remove the redundant functions, or at least clarify the equivalent behavior in the documentation.
class Test{
public static void main(String args[]){
jdk.incubator.vector.IntVector vy = jdk.incubator.vector.IntVector.fromArray(jdk.incubator.vector.IntVector.SPECIES_128,
new int[] { 1,0,1024,Integer.MAX_VALUE}, 0);
System.out.println(vy.viewAsFloatingLanes());
System.out.println(vy.reinterpretAsFloats());
jdk.incubator.vector.FloatVector vz = jdk.incubator.vector.FloatVector.fromArray(jdk.incubator.vector.FloatVector.SPECIES_128,
new float[] { 1.0f,0.0f,Float.NaN,Float.MAX_VALUE}, 0);
System.out.println(vz.viewAsIntegralLanes());
System.out.println(vz.reinterpretAsInts());
}
}
Ubuntu 22.04.2 LTS
openjdk version "20-internal" 2023-03-21
OpenJDK Runtime Environment (build 20-internal-adhoc.admin1.jdk-jdk-20-34)
OpenJDK 64-Bit Server VM (build 20-internal-adhoc.admin1.jdk-jdk-20-34, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The IntVector class (and also the FloatVector class) have redundant functions which seem to have the same behavior. The viewAsFloatingLanes() and the reinterpretAsFloats() functions do the same thing as illustrated in the attached example. The reason for this might be that these functions behave differently for vectors of different data types (when the bit size is different for the conversion), and they were just taken over into the IntVector class. To avoid confusion, it would be good to remove the redundant functions, or at least clarify the equivalent behavior in the documentation.
class Test{
public static void main(String args[]){
jdk.incubator.vector.IntVector vy = jdk.incubator.vector.IntVector.fromArray(jdk.incubator.vector.IntVector.SPECIES_128,
new int[] { 1,0,1024,Integer.MAX_VALUE}, 0);
System.out.println(vy.viewAsFloatingLanes());
System.out.println(vy.reinterpretAsFloats());
jdk.incubator.vector.FloatVector vz = jdk.incubator.vector.FloatVector.fromArray(jdk.incubator.vector.FloatVector.SPECIES_128,
new float[] { 1.0f,0.0f,Float.NaN,Float.MAX_VALUE}, 0);
System.out.println(vz.viewAsIntegralLanes());
System.out.println(vz.reinterpretAsInts());
}
}