RFR: 8279508: Auto-vectorize Math.round API [v3]

Jatin Bhateja jbhateja at openjdk.java.net
Wed Feb 16 12:30:28 UTC 2022


On Mon, 14 Feb 2022 17:14:10 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> That pseudocode would make a very useful comment too. This whole patch is very thinly commented.
>
>> > Hi, IIRC for evex encoding you can embed the RC control bit directly in the evex prefix, removing the need to rely on global MXCSR register. Thanks.
>> 
>> Hi @merykitty , You are correct, we can embed RC mode in instruction encoding of round instruction (towards -inf,+inf, zero). But to match the semantics of Math.round API one needs to add 0.5[f] to input value and then perform rounding over resultant value, which is why @sviswa7 suggested to use a global rounding mode driven by MXCSR.RC so that intermediate floating inexact values are resolved as desired, but OOO execution may misplace LDMXCSR and hence may have undesired side effects.
> 
> **Just want to correct above statement, LDMXCSR will not be re-ordered/re-scheduled early OOO backend.**

> That pseudocode would make a very useful comment too. This whole patch is very thinly commented.

I have replaced earlier bulky sequence, new sequence is having similar performance but reduction in code may improve inlining behavior.  Added descriptive comments around the special cases.

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

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


More information about the core-libs-dev mailing list