Skip to content

Commit

Permalink
8332905: C2 SuperWord: bad AD file, with RotateRightV and first opera…
Browse files Browse the repository at this point in the history
…nd not a pack

Reviewed-by: chagedorn, thartmann
  • Loading branch information
eme64 committed Jun 4, 2024
1 parent ca30726 commit 67d6f3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/superword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/*
* @test
* @bug 8183390 8332905
* @summary Vectorization test on bug-prone shift operation
* @library /test/lib /
*
Expand All @@ -48,6 +49,7 @@
public class ArrayShiftOpTest extends VectorizationTestRunner {

private static final int SIZE = 543;
private static int size = 543;

private int[] ints;
private long[] longs;
Expand All @@ -71,7 +73,7 @@ public ArrayShiftOpTest() {
}

@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"})
Expand All @@ -87,7 +89,23 @@ public int[] intCombinedRotateShift() {
}

@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"})
Expand Down

0 comments on commit 67d6f3c

Please sign in to comment.