[PATCH, GCC/ARM, 8/10] Do lazy store & load inline when calling nscall function
authorMihail Ionescu <mihail.ionescu@arm.com>
Wed, 15 Jan 2020 11:35:21 +0000 (11:35 +0000)
committerMihail Ionescu <mihail.ionescu@arm.com>
Thu, 16 Jan 2020 15:12:01 +0000 (15:12 +0000)
commit0ab81d9cc73303c376a0014774ab6058d40a25a0
tree3899d6792e134524941f0f809d93e5fbd2c7f887
parent1e4f3696a24aa0fcdca2dcadc2c7fc83ba6b2e5d
[PATCH, GCC/ARM, 8/10] Do lazy store & load inline when calling nscall function

This patch adds two new patterns for the VLSTM and VLLDM instructions.
cmse_nonsecure_call_inline_register_clear is then modified to
generate VLSTM and VLLDM respectively before and after calls to
functions with the cmse_nonsecure_call attribute in order to have lazy
saving, clearing and restoring of VFP registers. Since these
instructions do not do writeback of the base register, the stack is adjusted
prior the lazy store and after the lazy load with appropriate frame
debug notes to describe the effect on the CFA register.

As with CLRM, VSCCLRM and VSTR/VLDR, the instruction is modeled as an
unspecified operation to the memory pointed to by the base register.

*** 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 (arm_add_cfa_adjust_cfa_note): Declare early.
(cmse_nonsecure_call_inline_register_clear): Define new lazy_fpclear
variable as true when floating-point ABI is not hard.  Replace
check against TARGET_HARD_FLOAT_ABI by checks against lazy_fpclear.
Generate VLSTM and VLLDM instruction respectively before and
after a function call to cmse_nonsecure_call function.
* config/arm/unspecs.md (VUNSPEC_VLSTM): Define unspec.
(VUNSPEC_VLLDM): Likewise.
* config/arm/vfp.md (lazy_store_multiple_insn): New define_insn.
(lazy_load_multiple_insn): Likewise.

*** 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/soft/cmse-13.c: Add check for VLSTM and
VLLDM.
* gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8.c: Likewise.
13 files changed:
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/unspecs.md
gcc/config/arm/vfp.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7.c
gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8.c