8362979: C2 fails with unexpected node in SuperWord truncation: CmpLTMask, RoundF

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Jasmine Karthikeyan 2025-07-28 17:14:02 +00:00
parent fe4d7f8c1b
commit ea0b49c36d
3 changed files with 57 additions and 0 deletions

View File

@ -2597,6 +2597,9 @@ static bool can_subword_truncate(Node* in, const Type* type) {
case Op_IsFiniteD:
case Op_IsInfiniteF:
case Op_IsInfiniteD:
case Op_CmpLTMask:
case Op_RoundF:
case Op_RoundD:
case Op_ExtractS:
case Op_ExtractC:
case Op_ExtractB:

View File

@ -585,6 +585,21 @@ public class IRNode {
beforeMatchingNameRegex(CMP_P, "CmpP");
}
public static final String CMP_LT_MASK = PREFIX + "CMP_LT_MASK" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_LT_MASK, "CmpLTMask");
}
public static final String ROUND_F = PREFIX + "ROUND_F" + POSTFIX;
static {
beforeMatchingNameRegex(ROUND_F, "RoundF");
}
public static final String ROUND_D = PREFIX + "ROUND_D" + POSTFIX;
static {
beforeMatchingNameRegex(ROUND_D, "RoundD");
}
public static final String COMPRESS_BITS = PREFIX + "COMPRESS_BITS" + POSTFIX;
static {
beforeMatchingNameRegex(COMPRESS_BITS, "CompressBits");

View File

@ -389,6 +389,45 @@ public class TestSubwordTruncation {
}
}
@Test
@IR(counts = { IRNode.CMP_LT_MASK, ">0" })
@Arguments(setup = "setupByteArray")
public Object[] testCmpLTMask(byte[] in) {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
res[i] = (char) (in[i] >= 0 ? in[i] : 256 + in[i]);
}
return new Object[] { in, res };
}
@Test
@IR(counts = { IRNode.ROUND_F, ">0" })
@Arguments(setup = "setupByteArray")
public Object[] testRoundF(byte[] in) {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
res[i] = (short) Math.round(in[i] * 10.F);
}
return new Object[] { in, res };
}
@Test
@IR(counts = { IRNode.ROUND_D, ">0" })
@Arguments(setup = "setupByteArray")
public Object[] testRoundD(byte[] in) {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
res[i] = (short) Math.round(in[i] * 10.0);
}
return new Object[] { in, res };
}
public static void main(String[] args) {
TestFramework.run();
}