[AArch64] Add support for 16-bit FMOV immediates

Programming / Compilers / GCC - rsandifo [138bc75d-0d04-0410-961f-82ee72b054a4] - 2 August 2018 10:48 EDT

aarch64_float_const_representable_p was still returning false for HFmode, so we wouldn't use 16-bit FMOV immediate. E.g. before the patch:

__fp16 foo (void) { return 0x1.1p-3; }

gave:

mov w0, 12352 fmov h0, w0

with -march=armv8.2-a+fp16, whereas now it gives:

fmov h0, 1.328125e-1

2018-08-02 Richard Sandiford

gcc/
- config/aarch64/aarch64.c (aarch64_float_const_representable_p): Allow HFmode constants if TARGET_FP_F16INST.

gcc/testsuite/
- gcc.target/aarch64/f16_mov_immediate_1.c: Expect fmov immediate to be used.
- gcc.target/aarch64/f16_mov_immediate_2.c: Likewise.
- gcc.target/aarch64/f16_mov_immediate_3.c: Force +nofp16.
- gcc.target/aarch64/sve/single_1.c: Except fmov immediate to be used for .h.
- gcc.target/aarch64/sve/single_2.c: Likewise.
- gcc.target/aarch64/sve/single_3.c: Likewise.
- gcc.target/aarch64/sve/single_4.c: Likewise.

eb46ebeea05 [AArch64] Add support for 16-bit FMOV immediates
gcc/ChangeLog | 5 +++++
gcc/config/aarch64/aarch64.c | 4 ++--
gcc/testsuite/ChangeLog | 12 ++++++++++++
gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_1.c | 6 +++---
gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_2.c | 4 +---
gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_3.c | 2 ++
gcc/testsuite/gcc.target/aarch64/sve/single_1.c | 2 +-
gcc/testsuite/gcc.target/aarch64/sve/single_2.c | 2 +-
gcc/testsuite/gcc.target/aarch64/sve/single_3.c | 2 +-
gcc/testsuite/gcc.target/aarch64/sve/single_4.c | 2 +-
10 files changed, 29 insertions(+), 12 deletions(-)

Upstream: gcc.gnu.org


  • Share