RFR: 8308994: C2: Re-implement experimental post loop vectorization [v2]

Emanuel Peter epeter at openjdk.org
Tue Jul 4 12:05:18 UTC 2023


On Mon, 3 Jul 2023 09:44:53 GMT, Pengfei Li <pli at openjdk.org> wrote:

>> src/hotspot/share/opto/vmaskloop.cpp line 357:
>> 
>>> 355:             set_elem_bt(node, mem_type);
>>> 356:           } else {
>>> 357:             trace_msg(node, "Subword operand does not have precise type");
>> 
>> Not clear to me what this means.
>
> Precise type info about signedness means that we know exactly whether the data is signed or unsigned. For some operations, such as right shift, results are different for signed and unsigned operands, so C2 has to know the signedness. However, in any Java arithmetic operation, operands of Java subword types are promoted to int first. Sometimes, for example, if an intermediate result is a binary operation of both signed and unsigned, we don't have the precise type info, so we don't know how to vectorize it. (see below example where the signedness info is lost after a short and a char are added)
> 
> for (int i = 0; i < SIZE; i++) {
>   shorts[i] = (shorts[i] + chars[i]) >> 10;
> }

That is annoying. Do you think we can do something about this in the future, or is this just a fundamental restriction of Java / C2?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14581#discussion_r1251934470


More information about the hotspot-dev mailing list