RFR: 8282162: [vector] Optimize vector negation API

Jie Fu jiefu at openjdk.java.net
Fri Mar 25 09:07:45 UTC 2022


On Sat, 19 Mar 2022 03:11:12 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>>> Note that in terms of Java semantics, negation of floating point values needs to be implemented as subtraction from negative zero rather than positive zero:
>>> 
>>> double negate(double arg) {return -0.0 - arg; }
>>> 
>>> This is to handle signed zeros correctly.
>> 
>> Hi @jddarcy ,thanks for looking at this PR and thanks for the notes on the floating point negation! Yeah, this really makes sense to me. Kindly note that this patch didn't touch the negation of the floating point values. For Vector API, the vector floating point negation has been intrinsified to `NegVF/D` node by compiler that we directly generate the negation instructions for them. Thanks!
>
>> Note that in terms of Java semantics, negation of floating point values needs to be implemented as subtraction from negative zero rather than positive zero:
>> 
>> double negate(double arg) {return -0.0 - arg; }
>> 
>> This is to handle signed zeros correctly.
> 
> This seems easy to be broken by an opt enhancement.
> Just wondering do we have a jtreg test for this point? @jddarcy 
> Thanks.

> Hi @DamonFool , thanks for your review! All the comments have been addressed. Thanks!

Thanks @XiaohongGong for the update.
And sorry for the late (just a little busy this week).

I'll do some testing and feedback here.

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

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


More information about the core-libs-dev mailing list