[jdk17] RFR: 8269879: [PPC64] C2: Math.rint intrinsic uses wrong rounding mode

Lutz Schmidt lucy at openjdk.java.net
Mon Jul 5 20:45:52 UTC 2021


On Mon, 5 Jul 2021 20:05:29 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> We need to replace the frin and xvrdpi instructions which use a wrong rounding mode. xvrdpic is available with Power7. We can simply switch off RoundDoubleMode intrinsics for older processors (which are outdated).
> Note that xvrdpic requires RN=0b00 to use the correct rounding mode. These 2 bits are 0 by default (see "Registers Specified during Process Initialization" in [1]) and are treated as "Limited-Access Bits" (see "2.2.1.2. Limited-Access Bits" in [1] for preservation rules).
> 
> [1] "64-Bit ELF V2 ABI Specification" http://cdn.openpowerfoundation.org/wp-content/uploads/resources/leabi/leabi-20170510.pdf

The changes look good so far.

You are mentioning that the now used instruction is available from Power7 and that for older versions of the Power spec, the intrinsic should be disabled. I am missing such a change, probably in vm_version_ppc.cpp.

Furthermore, you mention that the instruction needs a special (non-default) setting of the rounding mode control flags. How can such flag setting be assured? 
Thanks, Lutz

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

Changes requested by lucy (Reviewer).

PR: https://git.openjdk.java.net/jdk17/pull/215


More information about the hotspot-compiler-dev mailing list