Skip to content

Commit 91c5bd5

Browse files
author
Jatin Bhateja
committed
8337791: VectorAPI jtreg ABSMaskedByteMaxVectorTests crashes with UseAVX=0 -XX:MaxVectorSize=8
Reviewed-by: epeter, sviswanathan, dlunden
1 parent df0165b commit 91c5bd5

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/hotspot/cpu/x86/x86.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,6 +3386,11 @@ bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType bt) {
33863386
return false;
33873387
}
33883388
break;
3389+
case Op_VectorBlend:
3390+
if (UseAVX == 0 && size_in_bits < 128) {
3391+
return false;
3392+
}
3393+
break;
33893394
case Op_VectorTest:
33903395
if (UseSSE < 4) {
33913396
return false; // Implementation limitation
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
package compiler.vectorapi;
24+
25+
import compiler.lib.ir_framework.*;
26+
import jdk.incubator.vector.*;
27+
28+
/*
29+
* @test
30+
* @bug 8337791
31+
* @summary Test byte vector predicated ABS with UseAVX=0 and MaxVectorSize=8
32+
* @modules jdk.incubator.vector
33+
* @library /test/lib /
34+
* @run driver compiler.vectorapi.TestABSMaskedMaxByteVector
35+
*/
36+
37+
public class TestABSMaskedMaxByteVector {
38+
public static final VectorSpecies<Byte> BSP = ByteVector.SPECIES_MAX;
39+
public static int idx = 0;
40+
41+
public static void main(String[] args) {
42+
TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-ea", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:UseAVX=0", "-XX:MaxVectorSize=8");
43+
TestFramework.runWithFlags("--add-modules=jdk.incubator.vector", "-ea");
44+
}
45+
46+
@Test
47+
@IR(failOn = {IRNode.ABS_VB}, applyIfAnd = {"MaxVectorSize", " <= 8 ", "UseAVX", "0"}, applyIfPlatform = {"x64", "true"}, applyIfCPUFeature = {"sse4.1", "true"})
48+
@IR(counts = {IRNode.ABS_VB, "1"}, applyIf = {"MaxVectorSize", " > 8 "}, applyIfPlatform = {"x64", "true"}, applyIfCPUFeature = {"sse4.1", "true"})
49+
public void test() {
50+
assert ByteVector.broadcast(BSP, (byte)-4)
51+
.lanewise(VectorOperators.ABS, VectorMask.fromLong(BSP, 0xF))
52+
.lane(idx++ & 3) == 4;
53+
}
54+
}

0 commit comments

Comments
 (0)