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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Nick Gasson
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
Reply | Threaded
Open this post in threaded view
|

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

Andrew Haley-2
On Fri, 2 Apr 2021 09:02:36 GMT, Nick Gasson <[hidden email]> wrote:

> 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.

Marked as reviewed by aph (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/3322
Reply | Threaded
Open this post in threaded view
|

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

Nick Gasson
In reply to this post by Nick Gasson
On Fri, 2 Apr 2021 09:02:36 GMT, Nick Gasson <[hidden email]> wrote:

> 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.

This pull request has now been integrated.

Changeset: 43d4a6f6
Author:    Nick Gasson <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/43d4a6f6
Stats:     5 lines in 3 files changed: 0 ins; 0 del; 5 mod

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

Reviewed-by: aph

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

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