From a554ebf2851f9d58cdc4d28fb36f8df64a041bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=A4ssig?= Date: Fri, 27 Mar 2026 13:27:22 +0100 Subject: [PATCH] Add result verification --- .../vectorization/TestSubwordTruncation.java | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java b/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java index 16215b1f059..85be750bbf9 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java @@ -23,6 +23,7 @@ package compiler.vectorization; +import jdk.test.lib.Asserts; import compiler.lib.ir_framework.*; import compiler.lib.generators.*; @@ -450,21 +451,45 @@ public class TestSubwordTruncation { @Test @IR(counts = { IRNode.UMOD_I, ">0" }) @Arguments(setup = "setupByteArray") - public void testUMod(final byte[] in) { + public Object[] testUMod(final byte[] in) { int n = G.next().intValue(); for (int i = 1; i < SIZE; i++) { in[i] = (byte) Integer.remainderUnsigned(n, i); } + + return new Object[] { (Object) Integer.valueOf(n), (Object) in }; + } + + @Check(test = "testUMod") + public void checkTestUMod(Object[] vals) { + int n = (Integer) vals[0]; + byte[] res = (byte[]) vals[1]; + for (int i = 1; i < SIZE; i++) { + byte val = (byte) Integer.remainderUnsigned(n, i); + Asserts.assertEQ(res[i], val); + } } @Test @IR(counts = { IRNode.UDIV_I, ">0" }) @Arguments(setup = "setupByteArray") - public void testUDiv(final byte[] in) { + public Object[] testUDiv(final byte[] in) { int n = G.next().intValue(); for (int i = 1; i < SIZE; i++) { in[i] = (byte) Integer.divideUnsigned(n, i); } + + return new Object[] { (Object) Integer.valueOf(n), (Object) in }; + } + + @Check(test = "testUDiv") + public void checkTestUDiv(Object[] vals) { + int n = (Integer) vals[0]; + byte[] res = (byte[]) vals[1]; + for (int i = 1; i < SIZE; i++) { + byte val = (byte) Integer.divideUnsigned(n, i); + Asserts.assertEQ(res[i], val); + } } @Test