8380988: C2: Unexpected node in SuperWord truncation: UModI/UDivI

Reviewed-by: epeter, jkarthikeyan
This commit is contained in:
Manuel Hässig 2026-03-30 06:27:30 +00:00
parent ca3fe721ba
commit 61df7cc8b9
2 changed files with 47 additions and 1 deletions

View File

@ -2500,7 +2500,9 @@ static bool can_subword_truncate(Node* in, const Type* type) {
switch (opc) {
case Op_AbsI:
case Op_DivI:
case Op_UDivI:
case Op_ModI:
case Op_UModI:
case Op_MinI:
case Op_MaxI:
case Op_CMoveI:

View File

@ -29,7 +29,7 @@ import compiler.lib.generators.*;
/*
* @test
* @bug 8350177 8362171 8369881 8342095
* @bug 8350177 8362171 8369881 8342095 8380988
* @summary Ensure that truncation of subword vectors produces correct results
* @library /test/lib /
* @run driver compiler.vectorization.TestSubwordTruncation
@ -448,6 +448,50 @@ public class TestSubwordTruncation {
}
}
@Test
@IR(counts = { IRNode.UMOD_I, ">0" })
@Arguments(setup = "setupByteArray")
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[] { Integer.valueOf(n), 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 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[] { Integer.valueOf(n), 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
@IR(counts = { IRNode.CMP_LT_MASK, ">0" })
@Arguments(setup = "setupByteArray")