From da99f1a330bfa363507908fe83ac2f8c7cd4b18a Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Mon, 2 Mar 2026 14:29:11 +0000 Subject: [PATCH] 8378897: assertion failure due to missing depends_only_on_test_impl definition in SqrtHFNode Reviewed-by: qamai --- src/hotspot/share/opto/subnode.hpp | 3 + .../c2/TestDependsOnTestSqrtHFAssertion.java | 69 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/c2/TestDependsOnTestSqrtHFAssertion.java diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index a90661c49ee..54cb1d20cd0 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -564,6 +564,9 @@ public: const Type* bottom_type() const { return Type::HALF_FLOAT; } virtual uint ideal_reg() const { return Op_RegF; } virtual const Type* Value(PhaseGVN* phase) const; + +private: + virtual bool depends_only_on_test_impl() const { return false; } }; diff --git a/test/hotspot/jtreg/compiler/c2/TestDependsOnTestSqrtHFAssertion.java b/test/hotspot/jtreg/compiler/c2/TestDependsOnTestSqrtHFAssertion.java new file mode 100644 index 00000000000..5ad9a927097 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestDependsOnTestSqrtHFAssertion.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2026, 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 8378897 + * @summary assertion failure due to missing depends_only_on_test_impl definition in SqrtHFNode + * @library /test/lib / + * @modules jdk.incubator.vector + * @requires vm.debug & vm.compiler2.enabled + * @run main/othervm --add-modules=jdk.incubator.vector compiler.c2.TestDependsOnTestSqrtHFAssertion + */ + +package compiler.c2; + +import jdk.incubator.vector.*; + +public class TestDependsOnTestSqrtHFAssertion { + public static int x1 = 10; + + public static int x2 = 20; + + public static int y = 30; + + public static int micro(int x1, int x2, int y, int ctr) { + int res = 0; + for (int i = 0; i < ctr; i++) { + if (y != 0) { + if (x1 > 0) { + if (x2 > 0) { + if (y != 0) { + res += (int)Float16.float16ToRawShortBits(Float16.sqrt(Float16.shortBitsToFloat16((short)(x1/y)))); + res += (int)Float16.float16ToRawShortBits(Float16.sqrt(Float16.shortBitsToFloat16((short)(x2/y)))); + } + } + } + } + } + return res; + } + + public static void main(String [] args) { + int res = 0; + for (int i = 0 ; i < 100000; i++) { + res += micro(x1, x2, y, i); + } + IO.println("PASS" + res); + } +}