RFR: 8271589: fatal error with variable shift count integer rotate operation.
Jatin Bhateja
jbhateja at openjdk.java.net
Mon Aug 2 18:16:36 UTC 2021
On Mon, 2 Aug 2021 16:17:10 GMT, Vladimir Kozlov <kvn 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.
>
> 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.
The shift is either an int value or a vector of an int value. If it's a vector !in2->is_Con() will make the condition true and no need to check for get_int due to short-circuiting.
> 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.
Will remove this before checking in the final version of the patch.
> Is this case from Vector API? I think in Java we can have only Int type for shifts.
This is to handle long rotates, SLP will insert a ConvI2L before broadcasting shift value into a long vector. In case of constant int value, ConvI2L::Value will create a constant of TypeLong and which is what is being handled here.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4956
More information about the hotspot-compiler-dev
mailing list