RFR: 8271589: fatal error with variable shift count integer rotate operation.

Vladimir Kozlov kvn at openjdk.java.net
Mon Aug 2 16:27:38 UTC 2021


On Mon, 2 Aug 2021 12:48:10 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> Problem seen on targets which do not support variable vector shifts, in such a case vector rotation node inferred by auto-vectorizer are not disintegrable into LeftShift/RightShift and Or operations.

I assume `TestLongVectRotate.java` should be also updated.

And you need add cases for Long type vector shifts if they can be generated.

src/hotspot/share/opto/superword.cpp line 2491:

> 2489:         Node* in1 = low_adr->in(1);
> 2490:         Node* in2 = p->at(0)->in(2);
> 2491:         assert(in2->bottom_type()->isa_int(), "Shift must always be an int value");

Why you removed the assert? What other types can be seen here?
The following code (specifically `in2->get_int()`) will fail if it is not Integer type.

src/hotspot/share/opto/vectornode.cpp line 1163:

> 1161:   } else if (VectorNode::is_invariant_vector(cnt)) {
> 1162:     // Scalar variable shift, handle replicates generated by auto vectorizer.
> 1163:     assert(VectorNode::is_invariant_vector(cnt), "Broadcast expected");

This assert is not needed anymore since you already checked for this case.

src/hotspot/share/opto/vectornode.cpp line 1171:

> 1169:       } else {
> 1170:          assert(cnt->bottom_type()->isa_long() &&
> 1171:                 cnt->bottom_type()->is_long()->is_con(), "Long constant expected");

Is this case from Vector API? I think in Java we can have only Int type for shifts.

-------------

Changes requested by kvn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4956


More information about the hotspot-compiler-dev mailing list