RFR: 8279508: Auto-vectorize Math.round API [v3]
Jatin Bhateja
jbhateja at openjdk.java.net
Sun Feb 13 13:12:07 UTC 2022
On Sun, 13 Feb 2022 10:58:19 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>>
>> - 8279508: Adding vectorized algorithms to match the semantics of rounding operations.
>> - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8279508
>> - 8279508: Adding a test for scalar intrinsification.
>> - 8279508: Auto-vectorize Math.round API
>
> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4066:
>
>> 4064: }
>> 4065:
>> 4066: void C2_MacroAssembler::vector_cast_double_special_cases_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1,
>
> What does this do? Comment, even pseudo code, would be nice.
> 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 round instructions (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 also are resolved as desired, but OOO execution may misplace LDMXCSR and hence may have undesired side effects.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7094
More information about the core-libs-dev
mailing list