]> git.ipfire.org Git - thirdparty/gcc.git/commit
AArch64: Block combine_and_move from creating FP literal loads
authorWilco Dijkstra <wilco.dijkstra@arm.com>
Fri, 1 Nov 2024 14:44:56 +0000 (14:44 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Tue, 7 Jan 2025 18:09:15 +0000 (18:09 +0000)
commit45d306a835cb3f865a897dc7c04efbe1f9f46c28
treed1bf42f244e91f25db3cbdae466588fc8b7d1403
parentd3ccd89fa0d34d44226af47fe82c27ba7833fe65
AArch64: Block combine_and_move from creating FP literal loads

The IRA combine_and_move pass runs if the scheduler is disabled and aggressively
combines moves.  The movsf/df patterns allow all FP immediates since they rely
on a split pattern.  However splits do not happen during IRA, so the result is
extra literal loads.  To avoid this, split early during expand and block
creation of FP immediates that need this split.  Mark a few testcases that
rely on late splitting as xfail.

double f(void) { return 128.0; }

-O2 -fno-schedule-insns gives:

adrp x0, .LC0
ldr d0, [x0, #:lo12:.LC0]
ret

After patch:

mov x0, 4638707616191610880
fmov d0, x0
ret

Passes bootstrap & regress, OK for commit?

gcc:
* config/aarch64/aarch64.md (movhf_aarch64): Use aarch64_valid_fp_move.
(movsf_aarch64): Likewise.
(movdf_aarch64): Likewise.
* config/aarch64/aarch64.cc (aarch64_valid_fp_move): New function.
* config/aarch64/aarch64-protos.h (aarch64_valid_fp_move): Likewise.

gcc/testsuite:
* gcc.target/aarch64/dbl_mov_immediate_1.c: Add xfail for -0.0.
* gcc.target/aarch64/fmul_scvtf_1.c: Fixup test cases, add xfail,
reduce duplication.
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.md
gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c
gcc/testsuite/gcc.target/aarch64/fmul_scvtf_1.c