[PATCH, GCC/ARM, 7/10] Clear all VFP regs inline in hardfloat nscall functions
authorMihail Ionescu <mihail.ionescu@arm.com>
Wed, 15 Jan 2020 11:33:30 +0000 (11:33 +0000)
committerMihail Ionescu <mihail.ionescu@arm.com>
Thu, 16 Jan 2020 15:11:49 +0000 (15:11 +0000)
commit1e4f3696a24aa0fcdca2dcadc2c7fc83ba6b2e5d
tree028bef77a772cd9471283a5b580c5fa365f35f5b
parent2d924ca620387c371cd564c821682012b3c97481
[PATCH, GCC/ARM, 7/10] Clear all VFP regs inline in hardfloat nscall functions

The patch is fairly straightforward in its approach and consist of the
following 3 logical changes:
- abstract the number of floating-point register to clear in
  max_fp_regno
- use max_fp_regno to decide how many registers to clear so that the
  same code works for Armv8-M and Armv8.1-M Mainline
- emit vpush and vpop instruction respectively before and after a
  nonsecure call

Note that as in the patch to clear GPRs inline, debug information has to
be disabled for VPUSH and VPOP due to VPOP adding CFA adjustment note
for SP when R7 is sometimes used as CFA.

ChangeLog entries are as follows:

*** gcc/ChangeLog ***

2020-01-16  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
2020-01-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* config/arm/arm.c (vfp_emit_fstmd): Declare early.
(arm_emit_vfp_multi_reg_pop): Likewise.
(cmse_nonsecure_call_inline_register_clear): Abstract number of VFP
registers to clear in max_fp_regno.  Emit VPUSH and VPOP to save and
restore callee-saved VFP registers.

*** gcc/testsuite/ChangeLog ***

2020-01-16  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
2020-01-16  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-13.c: Add check for
VPUSH and VPOP and update expectation for VSCCLRM.
* gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-7.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-8.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/hard/cmse-13.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/hard/cmse-7.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/hard/cmse-8.c: Likewise.
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard-sp/cmse-8.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/hard/cmse-8.c