RFR: 8264564: AArch64: use MOVI instead of FMOV to zero FP register

Nick Gasson ngasson at openjdk.java.net
Fri Apr 2 09:08:41 UTC 2021


HotSpot generates an FMOV from ZR to zero a floating point register:

   fmov d0, xzr

This used to be recommended by the Arm ARM, but that advice was removed
in revision A.j and subsequent revisions (section C.5.3).

Integer->FP moves may be slow on some cores. Instead the preferred
instruction is MOVI with immediate zero:

   movi d0, #0x0

Some micro-architectures special-case FMOV from ZR, and on those cores
this change will have no effect, but in any case FMOV won't be faster
than MOVI.

GCC made this change back in 2016:
  https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=523d72071960

Tested tier1 on AArch64. I don't expect this to have any visible effect
on benchmarks.

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

Commit messages:
 - 8264564: AArch64: use MOVI instead of FMOV to zero FP register

Changes: https://git.openjdk.java.net/jdk/pull/3322/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3322&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264564
  Stats: 5 lines in 3 files changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3322.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3322/head:pull/3322

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


More information about the hotspot-dev mailing list