From 84973dba2e49ec917774f79e8e4d524d31cbb487 Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Tue, 31 May 2022 15:23:44 -0700 Subject: [PATCH 1/4] 8287517: C2: assert(vlen_in_bytes == 64) failed: 2 --- src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp | 2 +- src/hotspot/cpu/x86/x86.ad | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 5ff729f64c1aa..01bf8f5db3ac2 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -1501,7 +1501,7 @@ void C2_MacroAssembler::load_vector(XMMRegister dst, AddressLiteral src, int vle void C2_MacroAssembler::load_iota_indices(XMMRegister dst, Register scratch, int vlen_in_bytes) { ExternalAddress addr(StubRoutines::x86::vector_iota_indices()); - if (vlen_in_bytes == 4) { + if (vlen_in_bytes <= 4) { movdl(dst, addr); } else if (vlen_in_bytes == 8) { movq(dst, addr); diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index 07ed62f293d8f..5bab7c3ba6185 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1846,6 +1846,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType if (size_in_bits > 256 && !VM_Version::supports_avx512bw()) { return false; } + break; case Op_VectorCastB2X: case Op_VectorCastS2X: case Op_VectorCastI2X: From 1939a73a1fa7d7bdcd8b0019d8f059dd90026979 Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Thu, 2 Jun 2022 17:04:27 -0700 Subject: [PATCH 2/4] Add regression test --- .../compiler/vectorization/cr8287517.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/vectorization/cr8287517.java diff --git a/test/hotspot/jtreg/compiler/vectorization/cr8287517.java b/test/hotspot/jtreg/compiler/vectorization/cr8287517.java new file mode 100644 index 0000000000000..8992d5ebc66f3 --- /dev/null +++ b/test/hotspot/jtreg/compiler/vectorization/cr8287517.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** +* @test +* @bug 8287517 +* @summary Test bug fix for JDK-8287517 related to fuzzer test failure in x86_64 +* @requires vm.compiler2.enabled +* @requires (os.simpleArch == "x64" & vm.cpu.features ~= ".*avx2.*") | +* (os.simpleArch == "aarch64" & vm.cpu.features ~= ".*sve.*") +* @run main/othervm -Xcomp -XX:CompileOnly=compiler/vectorization/cr8287517.test -XX:MaxVectorSize=8 compiler.vectorization.cr8287517 +*/ + +package compiler.vectorization; + +public class cr8287517 { + private static final int count = 1000; + + private static float[] f; + + public static void main(String args[]) { + cr8287517 t = new cr8287517(); + t.test(); + } + + public cr8287517() { + f = new float[count]; + } + + public void test() { + for (int i = 0; i < count; i++) { + f[i] = i * i + 100; + } + checkResult(); + } + + public void checkResult() { + for (int i = 0; i < count; i++) { + float expected = i * i + 100; + if (f[i] != expected) { + throw new RuntimeException("Invalid result: f[" + i + "] = " + f[i] + " != " + expected); + } + } + } +} From 37639f5f808368a0389fd899f59f61eabb3926ec Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Thu, 2 Jun 2022 17:26:23 -0700 Subject: [PATCH 3/4] Remove requires from test --- test/hotspot/jtreg/compiler/vectorization/cr8287517.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/vectorization/cr8287517.java b/test/hotspot/jtreg/compiler/vectorization/cr8287517.java index 8992d5ebc66f3..fe770356af163 100644 --- a/test/hotspot/jtreg/compiler/vectorization/cr8287517.java +++ b/test/hotspot/jtreg/compiler/vectorization/cr8287517.java @@ -26,8 +26,6 @@ * @bug 8287517 * @summary Test bug fix for JDK-8287517 related to fuzzer test failure in x86_64 * @requires vm.compiler2.enabled -* @requires (os.simpleArch == "x64" & vm.cpu.features ~= ".*avx2.*") | -* (os.simpleArch == "aarch64" & vm.cpu.features ~= ".*sve.*") * @run main/othervm -Xcomp -XX:CompileOnly=compiler/vectorization/cr8287517.test -XX:MaxVectorSize=8 compiler.vectorization.cr8287517 */ From dd5adaef98c4d1fee785fe6cfd935b426f1635ad Mon Sep 17 00:00:00 2001 From: Sandhya Viswanathan Date: Fri, 3 Jun 2022 10:56:00 -0700 Subject: [PATCH 4/4] Change test name --- .../{cr8287517.java => TestSmallVectorPopIndex.java} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename test/hotspot/jtreg/compiler/vectorization/{cr8287517.java => TestSmallVectorPopIndex.java} (88%) diff --git a/test/hotspot/jtreg/compiler/vectorization/cr8287517.java b/test/hotspot/jtreg/compiler/vectorization/TestSmallVectorPopIndex.java similarity index 88% rename from test/hotspot/jtreg/compiler/vectorization/cr8287517.java rename to test/hotspot/jtreg/compiler/vectorization/TestSmallVectorPopIndex.java index fe770356af163..09fbd162c4b34 100644 --- a/test/hotspot/jtreg/compiler/vectorization/cr8287517.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestSmallVectorPopIndex.java @@ -26,22 +26,22 @@ * @bug 8287517 * @summary Test bug fix for JDK-8287517 related to fuzzer test failure in x86_64 * @requires vm.compiler2.enabled -* @run main/othervm -Xcomp -XX:CompileOnly=compiler/vectorization/cr8287517.test -XX:MaxVectorSize=8 compiler.vectorization.cr8287517 +* @run main/othervm -Xcomp -XX:CompileOnly=compiler/vectorization/TestSmallVectorPopIndex.test -XX:MaxVectorSize=8 compiler.vectorization.TestSmallVectorPopIndex */ package compiler.vectorization; -public class cr8287517 { +public class TestSmallVectorPopIndex { private static final int count = 1000; private static float[] f; public static void main(String args[]) { - cr8287517 t = new cr8287517(); + TestSmallVectorPopIndex t = new TestSmallVectorPopIndex(); t.test(); } - public cr8287517() { + public TestSmallVectorPopIndex() { f = new float[count]; }