RFR: 8266054: VectorAPI rotate operation optimization [v13]

Sandhya Viswanathan sviswanathan at openjdk.java.net
Tue Jul 27 18:08:35 UTC 2021


On Tue, 27 Jul 2021 08:17:55 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/share/opto/vectorIntrinsics.cpp line 1598:
>> 
>>> 1596:       cnt = elem_bt == T_LONG ? gvn().transform(new ConvI2LNode(cnt)) : cnt;
>>> 1597:       opd2 = gvn().transform(VectorNode::scalar2vector(cnt, num_elem, type_bt));
>>> 1598:     } else {
>> 
>> Why conversion for only T_LONG and not for T_BYTE and T_SHORT? Is there an assumption here that only T_INT and T_LONG elem_bt are supported?
>
> Correcting this,  I2L may be needed in auto-vectorization flow since Integer/Long.rotate[Right/Left] APIs accept only integral shift, so for Long.rotate* operations integral shift value must be converted to long using I2L before broadcasting it. VectorAPI lanewise operations between vector-scalar, scalar type already matches with vector basic type.  Since degeneration routine is common b/w both the flows so maintaining IR consistency here.

For Vector API the shift is always coming in as int type for rotate by scalar (lanewiseShiftTemplate). The down conversion to byte or short needs to be done before scalar2vector.

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

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


More information about the core-libs-dev mailing list