RFR: 6506405: Math.abs(float) is slow [v2]

Joe Darcy joe.darcy at oracle.com
Thu Jul 8 18:25:14 UTC 2021


PS The benefit of an intrinsic in a case like this is being to use a 
platform-optimized implementation, trading off native instruction, 
floating-point branch, and bitwise conversion costs.

-Joe

On 7/8/2021 4:26 AM, Joe Darcy wrote:
> On 7/8/2021 3:50 AM, Andrew Haley wrote:
>> On Thu, 8 Jul 2021 09:43:35 GMT, Andrew Haley <aph at openjdk.org> wrote:
>>
>>> Moves between GPRs and FPRs are often slow. There's a 10-cycle 
>>> latency on some AArch64, so we avoid it whenever we can. Mind you, 
>>> we don't care about this patch because we always generate FABS from 
>>> an intrinsic anyway.
>> For avoidance of doubt, that's the round-trip latency.
>>
>> -------------
>>
>> PR: https://git.openjdk.java.net/jdk/pull/4711
>
>
> For coding this functionality in Java, the natural way to do this uses 
> either an if statement or the bit-wise conversion, which usually 
> implies GPRs to/from FPRs movement. I don't see a way to avoid both an 
> if statement and bitwise conversion.
>
> -Joe
>


More information about the core-libs-dev mailing list