RFR: 8257483: C2: Split immediate vector rotate from RotateLeftV and RotateRightV nodes [v4]

Dong Bo dongbo at openjdk.java.net
Mon Dec 7 12:11:18 UTC 2020


On Thu, 3 Dec 2020 17:48:12 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Yes, it works just the same as you mentioned. Thanks a lot to make this so clear.
>> The degeneration to `OrV+LShiftV+URShiftV` is at `RotateLeftVNode::Ideal()`, then `VectorNode::degenerate_vector_rotate()`:
>> `RotateLeft ==vectorizes==> RotateLeftV    ==degenerates(RotateLeftVNode::Ideal, VectorNode::degenerate_vector_rotate())==> OrV+LShiftV+URShiftV`
>> 
>> However, the workflow relys on the creation of `RotateLeftV` node, and the creation of `RotateLeftV` with variables should be forbidden if one CPU match RotateLeftV/RotateRightV only with constant shifts.
>> Otherwise, `Matcher::Label_Root()` will check wether the AD files have implemented the matching rules for RotateLeftV with variables.
>> If there are no rules for `RotateLeftV` with variables, while we have rules for `RotateLeftV` with constants, we get a crash at https://github.com/openjdk/jdk/blob/fa58671f9f8a8230d907c0a6289685f8455bce1f/src/hotspot/share/opto/matcher.cpp#L1669.
>> 
>> IMHO, seems ajusting checks in `RotateLeftV::Ideal` does not deliver the solution, since there are no `RotateRightV` for variable shifts from the start.
>
>> However, the workflow relys on the creation of RotateLeftV node, and the creation of RotateLeftV with variables should be forbidden if one CPU match RotateLeftV/RotateRightV only with constant shifts.
> 
> But degeneration step is specifically designed to cover the case when rotate vector node is not supported by the matcher.
> It is perfectly fine to instantiate RotateV node considering it will be replaced by OrV+LShiftV+URShiftV before matcher kicks in. You just need to adjust the check so it works properly, don't you?

Hi, @iwanowww 

I have updated a version, in which I ajusted the checks in function `Ideal`.
But I haven't revieved related mails of this version from mailist `hotspot-compiler-dev` by far.
In case you haven't netither, the modifications are available at https://github.com/openjdk/jdk/pull/1532/files.

Thanks.

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

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


More information about the hotspot-compiler-dev mailing list