On Sat, 26 Feb 2022 03:02:51 GMT, Sandhya Viswanathan 
<sviswanat...@openjdk.org> wrote:

>> src/hotspot/cpu/x86/x86.ad line 7263:
>> 
>>> 7261:     __ vector_round_float_avx($dst$$XMMRegister, $src$$XMMRegister, 
>>> $xtmp1$$XMMRegister,
>>> 7262:                               $xtmp2$$XMMRegister, 
>>> $xtmp3$$XMMRegister, $xtmp4$$XMMRegister,
>>> 7263:                               
>>> ExternalAddress(vector_float_signflip()), new_mxcsr, $scratch$$Register, 
>>> vlen_enc);
>> 
>> The vector_float_signflip() here should be replaced by vector_all_bits_set().
>> cvtps2dq description:
>> If a converted result cannot be represented in the destination
>> format, the floating-point invalid exception is raised, and if this 
>> exception is masked, the indefinite integer value
>> (2w-1, where w represents the number of bits in the destination format) is 
>> returned.
>
> Clarification, the number in my comments above is (2^w  - 1). This is from 
> Intel SDM 
> (https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html).
> Also you will need to take care when the valid unoverflowed result is -1 i.e. 
> 0xFFFFFFFF (2^32 - 1).

I believe the indefinite value should be 2^(w - 1) (a.k.a 0x80000000) and the 
documentation is typoed. If you look at `cvtss2si`, the indefinite value is 
also written as 2^w - 1 but yet in `MacroAssembler::convert_f2i` we compare it 
with 0x80000000. In addition, choosing -1 as an indefinite value is weird 
enough and to complicate it as 2^w - 1 is really unusual.

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

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

Reply via email to