[jdk18] RFR: 8278889: AArch64: [vectorapi] VectorMaskLoadStoreTest.testMaskCast() test fail

Eric Liu eliu at openjdk.java.net
Mon Dec 20 15:43:56 UTC 2021


This bug appears intermittently and it's caused by vmaskAll_immI[1]
when the vector mask size is smaller than max predicate size of running
machine. It generates an all-true predicate without considering those
inactive bits. That may result in the wrong result of VectorMask.toLong.
The problematic code is as below:


        ShortVector.SPECIES_64.MaskAll(true).toLong()

assembly:

        ptrue   p0.h          <= MaskAll(true)
        mov     z16.h, p0/z, #1
        mov     z17.h, #0
        uzp1    z16.b, z16.b, z17.b
        fmov    x10, d16
        orr     x10, x10, x10, lsr #7
        orr     x10, x10, x10, lsr #14
        orr     x10, x10, x10, lsr #28
        and     x10, x10, #0xff

(gdb) p/x $p0 # on an SVE machine with vector length as 64 in bytes
$1 = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55}

Expected:
(gdb) p/x $p0
$1 = {0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}



Considering MaskAll is used in VectorMask.fromLong() only for a special
case and relies on the mechanism of inline and intrinsification, even it
could be optimized out, this patch also adds test cases for MaskAll to
reproduce this issue stably.

Also fix a small issue on register utilization for
sve_reduce_[max|min][D|F].

[1] https://github.com/openjdk/jdk18/blob/master/src/hotspot/cpu/aarch64/aarch64_sve.ad#L416

hotspot/compiler/vectorapi, jdk/incubator/vector passed on SVE enabled
system.

Change-Id: I9631f26f9232ffe7a28b74f14062d945c32fa1fb

-------------

Commit messages:
 - 8278889: AArch64: [vectorapi] VectorMaskLoadStoreTest.testMaskCast() test fail

Changes: https://git.openjdk.java.net/jdk18/pull/49/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk18&pr=49&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8278889
  Stats: 391 lines in 37 files changed: 300 ins; 0 del; 91 mod
  Patch: https://git.openjdk.java.net/jdk18/pull/49.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk18 pull/49/head:pull/49

PR: https://git.openjdk.java.net/jdk18/pull/49


More information about the hotspot-compiler-dev mailing list