-
Bug
-
Resolution: Fixed
-
P2
-
16, 17
-
b34
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8260321 | 17 | Jie Fu | P2 | Resolved | Fixed | b07 |
JDK-8260442 | 16.0.1 | Jie Fu | P2 | Resolved | Fixed | b03 |
This reproducer generates wrong results on x86.
```
import jdk.incubator.vector.ByteVector;
import jdk.incubator.vector.VectorSpecies;
import java.util.Arrays;
public class Test {
static final VectorSpecies<Byte> SPECIES_256 = ByteVector.SPECIES_256;
static final VectorSpecies<Byte> SPECIES_128 = ByteVector.SPECIES_128;
static byte[] a = new byte[32];
static byte[] b = new byte[32];
private static void func() {
ByteVector av = ByteVector.fromArray(SPECIES_256, a, 0);
ByteVector bv = (ByteVector)av.reinterpretShape(SPECIES_128, 0).reinterpretShape(SPECIES_256, 0);
bv.intoArray(b, 0);
}
public static void main(String[] args) {
for (int i = 0; i < a.length; i++) {
a[i] = (byte)i;
}
for (int i = 0; i < 100000; i++) {
func();
}
System.out.println("a: " + Arrays.toString(a));
System.out.println("b: " + Arrays.toString(b));
}
}
```
Output:
```
a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
```
Expected:
```
a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
```
```
import jdk.incubator.vector.ByteVector;
import jdk.incubator.vector.VectorSpecies;
import java.util.Arrays;
public class Test {
static final VectorSpecies<Byte> SPECIES_256 = ByteVector.SPECIES_256;
static final VectorSpecies<Byte> SPECIES_128 = ByteVector.SPECIES_128;
static byte[] a = new byte[32];
static byte[] b = new byte[32];
private static void func() {
ByteVector av = ByteVector.fromArray(SPECIES_256, a, 0);
ByteVector bv = (ByteVector)av.reinterpretShape(SPECIES_128, 0).reinterpretShape(SPECIES_256, 0);
bv.intoArray(b, 0);
}
public static void main(String[] args) {
for (int i = 0; i < a.length; i++) {
a[i] = (byte)i;
}
for (int i = 0; i < 100000; i++) {
func();
}
System.out.println("a: " + Arrays.toString(a));
System.out.println("b: " + Arrays.toString(b));
}
}
```
Output:
```
a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
```
Expected:
```
a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
b: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
```
- backported by
-
JDK-8260321 [Vector API] Incorrect code-gen for VectorReinterpret operation
- Resolved
-
JDK-8260442 [Vector API] Incorrect code-gen for VectorReinterpret operation
- Resolved