JDK-8274533 : [Vector API] Incorrect computation by VectorMask.toLong operation after JDK-8273949
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-panama
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86
  • Submitted: 2021-09-30
  • Updated: 2021-10-01
  • Resolved: 2021-10-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-panamaResolved
Related Reports
Duplicate :  
Relates :  
Description
Reproducer:

```
public class VectorMaskToLong {
    static final VectorSpecies<Integer> SPECIES = IntVector.SPECIES_128;
    static long maskFromToLongInt128VectorTest(long inputLong) {
        var vmask = VectorMask.fromLong(SPECIES, inputLong);
        return vmask.toLong();
    }

    static long expected(long inputLong) {
        return inputLong & (((1L << (SPECIES.length() - 1)) << 1) - 1);
    }

    public static void main(String[] args) {
        for (int i = 0; i < 100000; i++) {
            long res = maskFromToLongInt128VectorTest(-1);
            long exp = expected(-1);
            if (res != exp) {
                System.err.println("Failure: res = " + res + " exp = " + exp);
                System.exit(-1);
            }
        }
    }
}
```