8332905: C2 SuperWord: bad AD file, with RotateRightV and first operand not a pack

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Emanuel Peter 2024-06-04 06:20:31 +00:00
parent ca30726352
commit 67d6f3ca9e
2 changed files with 21 additions and 3 deletions
src/hotspot/share/opto
test/hotspot/jtreg/compiler/vectorization/runner

@ -2435,7 +2435,7 @@ bool SuperWord::output() {
vn = StoreVectorNode::make(opc, ctl, mem, adr, atyp, val, vlen);
vlen_in_bytes = vn->as_StoreVector()->memory_size();
} else if (VectorNode::is_scalar_rotate(n)) {
Node* in1 = first->in(1);
Node* in1 = vector_opd(p, 1);
Node* in2 = first->in(2);
// If rotation count is non-constant or greater than 8bit value create a vector.
if (!in2->is_Con() || !Matcher::supports_vector_constant_rotates(in2->get_int())) {

@ -23,6 +23,7 @@
/*
* @test
* @bug 8183390 8332905
* @summary Vectorization test on bug-prone shift operation
* @library /test/lib /
*
@ -48,6 +49,7 @@ import java.util.Random;
public class ArrayShiftOpTest extends VectorizationTestRunner {
private static final int SIZE = 543;
private static int size = 543;
private int[] ints;
private long[] longs;
@ -71,7 +73,7 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512f", "true"},
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeature = {"avx512f", "true"},
counts = {IRNode.ROTATE_RIGHT_V, ">0"})
@ -87,7 +89,23 @@ public class ArrayShiftOpTest extends VectorizationTestRunner {
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx512f", "true"},
@IR(applyIfCPUFeatureOr = {"sve", "true", "avx2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeature = {"avx512f", "true"},
counts = {IRNode.ROTATE_RIGHT_V, ">0"})
// Requires size to not be known at compile time, otherwise the shift
// can get constant folded with the (iv + const) pattern from the
// PopulateIndex.
public int[] intCombinedRotateShiftWithPopulateIndex() {
int[] res = new int[size];
for (int i = 0; i < size; i++) {
res[i] = (i << 14) | (i >>> 18);
}
return res;
}
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "avx2", "true"},
counts = {IRNode.STORE_VECTOR, ">0"})
@IR(applyIfCPUFeature = {"avx512f", "true"},
counts = {IRNode.ROTATE_RIGHT_V, ">0"})