RFR: 8279651: [vectorapi] Implement the missing intrinsics for casting from integrals on x64 [v8]

Quan Anh Mai duke at openjdk.java.net
Tue Jan 18 15:44:28 UTC 2022


On Mon, 17 Jan 2022 19:12:42 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix
>
> src/hotspot/cpu/x86/x86.ad line 1787:
> 
>> 1785:     case Op_VectorCastB2X:
>> 1786:     case Op_VectorCastS2X:
>> 1787:     case Op_VectorCastI2X:
> 
> I don't see any new code added for `VectorCastI2X`. Why is it so?

This part is redundant, as above the only candidates for 256-bit vector on AVX1 is float and double. However, to cast to a 256-bit float vector we need a 256-bit int vector which is not supported, so a <= 128-bit int vector can only be casted to a 256-bit vector of type double.

> src/hotspot/cpu/x86/x86.ad line 1793:
> 
>> 1791:       break;
>> 1792:     case Op_VectorCastL2X:
>> 1793:       if (is_integral_type(bt) && size_in_bits == 256 && UseAVX < 2) {
> 
> No new code for `VectorCastL2X` to integral types? Why?

This is also redundant, the only long vector that can appear in AVX1 is <= 128-bit, so we can't cast to 256-bit integral vectors here.

> src/hotspot/cpu/x86/x86.ad line 6951:
> 
>> 6949: 
>> 6950: instruct vcastStoX_evex(vec dst, vec src) %{
>> 6951:   predicate((Matcher::vector_element_basic_type(n) == T_BYTE && UseAVX > 2 && VM_Version::supports_avx512vlbw()) ||
> 
> The following code is redundant:
> 
>   switch (to_elem_bt) {
>       case T_BYTE:
>         if (!VM_Version::supports_avx512vl()) {
>           vlen_enc = Assembler::AVX_512bit;
>         }

Yes it is. However, the intention of this code seems that `vpmovwb` is promoted to `AVX_512bit` when avx512vl is not available, and the predicate is too restrictive. I think this needs a closer look.

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

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


More information about the hotspot-compiler-dev mailing list