RFR: 8282711: Accelerate Math.signum function for AVX and AVX512 target. [v6]

Jatin Bhateja jbhateja at openjdk.java.net
Thu Apr 14 05:57:53 UTC 2022


On Wed, 13 Apr 2022 21:04:15 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> src/hotspot/cpu/x86/x86.ad line 6114:
>> 
>>> 6112: 
>>> 6113: instruct signumV_reg_evex(vec dst, vec src, vec zero, vec one, kReg ktmp1) %{
>>> 6114:   predicate(Matcher::vector_length_in_bytes(n) ==  64);
>> 
>> avx512vl check is needed here. vector_signum_evex needs avx512vl support.
>
> Further clarification here: The vector_signum_evex code is faster than vector_signum_vex. On AVX=3 platforms vector_signum_evex should be used for all vector lengths.
> So the predicate for signumV_reg_evex should be:
>     ((VM_Version::supports_avx512vl()) || (Matcher::vector_length_in_bytes(n) == 64))
> Accordingly the predicate for signumV_reg_avx should be adjusted to be reverse of this.

I removed it because instruction sequence for AVX2 saves an extra vector compare instruction,  so we can emit AVX512 sequence only in case of 64 byte vector operation.

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

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


More information about the hotspot-compiler-dev mailing list