Re: [PATCH v2] arm: Warn if IRQ handler is not compiled with -mgeneral-regs-only [PR target/94743]

2020-06-29 Thread Christophe Lyon via Gcc-patches
Ping?

On Tue, 9 Jun 2020 at 11:48, Christophe Lyon  wrote:
>
> Ping?
>
> Maybe I could mention that LLVM emits a warning in this case
> (https://reviews.llvm.org/D28820).
>
> Thanks,
>
> Christophe
>
>
> On Wed, 3 Jun 2020 at 15:23, Christophe Lyon  
> wrote:
> >
> > Ping?
> > https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545747.html
> >
> > On Wed, 27 May 2020 at 13:52, Christophe Lyon
> >  wrote:
> > >
> > > Ping?
> > >
> > > On Thu, 14 May 2020 at 16:57, Christophe Lyon
> > >  wrote:
> > > >
> > > > The interrupt attribute does not guarantee that the FP registers are
> > > > saved, which can result in problems difficult to debug.
> > > >
> > > > Saving the FP registers and status registers can be a large penalty,
> > > > so it's probably not desirable to do that all the time.
> > > >
> > > > If the handler calls other functions, we'd likely need to save all of
> > > > them, for lack of knowledge of which registers they actually clobber.
> > > >
> > > > This is even more obscure for the end-user when the compiler inserts
> > > > calls to helper functions such as memcpy (some multilibs do use FP
> > > > registers to speed it up).
> > > >
> > > > In the PR, we discussed adding routines in libgcc to save the FP
> > > > context and saving only locally-clobbered FP registers, but this seems
> > > > to be too much work for the purpose, given that in general such
> > > > handlers try to avoid this kind of penalty.
> > > > I suspect we would also want new attributes to instruct the compiler
> > > > that saving the FP context is not needed.
> > > >
> > > > In the mean time, emit a warning to suggest re-compiling with
> > > > -mgeneral-regs-only. Note that this can lead to errors if the code
> > > > uses floating-point and -mfloat-abi=hard, eg:
> > > > argument of type 'double' not permitted with -mgeneral-regs-only
> > > >
> > > > This can be troublesome for the user, but at least this would make
> > > > him aware of the latent issue.
> > > >
> > > > The patch adds several testcases:
> > > >
> > > > - pr94734-1-hard.c checks that a warning is emitted when using
> > > >   -mfloat-abi=hard. Function IRQ_HDLR_Test can make implicit calls to
> > > >   runtime floating-point routines (or direct use of FP instructions),
> > > >   IRQ_HDLR_Test2 doesn't. We emit a warning in both cases, though.
> > > >
> > > > - pr94734-1-softfp.c: same as above wih -mfloat-abi=softfp.
> > > >
> > > > - pr94734-1-soft.c checks that no warning is emitted when using
> > > >   -mfloat-abi=soft when the same code as above.
> > > >
> > > > - pr94734-2.c checks that no warning is emitted when using
> > > >   -mgeneral-regs-only.
> > > >
> > > > - pr94734-3.c checks that no warning is emitted when using
> > > >   -mgeneral-regs-only even using float-point data.
> > > >
> > > > 2020-05-14  Christophe Lyon  
> > > >
> > > > PR target/94743
> > > > gcc/
> > > > * config/arm/arm.c (arm_handle_isr_attribute): Warn if
> > > > -mgeneral-regs-only is not used.
> > > >
> > > > gcc/testsuite/
> > > > * gcc.misc-tests/arm-isr.c: Add -mgeneral-regs-only.
> > > > * gcc.target/arm/empty_fiq_handler.c: Add -mgeneral-regs-only.
> > > > * gcc.target/arm/interrupt-1.c: Add -mgeneral-regs-only.
> > > > * gcc.target/arm/interrupt-2.c: Add -mgeneral-regs-only.
> > > > * gcc.target/arm/pr70830.c: Add -mgeneral-regs-only.
> > > > * gcc.target/arm/pr94743-1-hard.c: New test.
> > > > * gcc.target/arm/pr94743-1-soft.c: New test.
> > > > * gcc.target/arm/pr94743-1-softfp.c: New test.
> > > > * gcc.target/arm/pr94743-2.c: New test.
> > > > * gcc.target/arm/pr94743-3.c: New test.
> > > > ---
> > > >  gcc/config/arm/arm.c |  5 
> > > >  gcc/testsuite/gcc.misc-tests/arm-isr.c   |  2 ++
> > > >  gcc/testsuite/gcc.target/arm/empty_fiq_handler.c |  1 +
> > > >  gcc/testsuite/gcc.target/arm/interrupt-1.c   |  2 +-
> > > >  gcc/testsuite/gcc.target/arm/interrupt-2.c   |  2 +-
> > > >  gcc/testsuite/gcc.target/arm/pr70830.c   |  2 +-
> > > >  gcc/testsuite/gcc.target/arm/pr94743-1-hard.c| 29 
> > > > 
> > > >  gcc/testsuite/gcc.target/arm/pr94743-1-soft.c| 27 
> > > > ++
> > > >  gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c  | 29 
> > > > 
> > > >  gcc/testsuite/gcc.target/arm/pr94743-2.c | 22 
> > > > ++
> > > >  gcc/testsuite/gcc.target/arm/pr94743-3.c | 23 
> > > > +++
> > > >  11 files changed, 141 insertions(+), 3 deletions(-)
> > > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c
> > > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c
> > > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c
> > > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-2.c
> > > >  create mode 100644 

Re: [PATCH v2] arm: Warn if IRQ handler is not compiled with -mgeneral-regs-only [PR target/94743]

2020-06-09 Thread Christophe Lyon via Gcc-patches
Ping?

Maybe I could mention that LLVM emits a warning in this case
(https://reviews.llvm.org/D28820).

Thanks,

Christophe


On Wed, 3 Jun 2020 at 15:23, Christophe Lyon  wrote:
>
> Ping?
> https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545747.html
>
> On Wed, 27 May 2020 at 13:52, Christophe Lyon
>  wrote:
> >
> > Ping?
> >
> > On Thu, 14 May 2020 at 16:57, Christophe Lyon
> >  wrote:
> > >
> > > The interrupt attribute does not guarantee that the FP registers are
> > > saved, which can result in problems difficult to debug.
> > >
> > > Saving the FP registers and status registers can be a large penalty,
> > > so it's probably not desirable to do that all the time.
> > >
> > > If the handler calls other functions, we'd likely need to save all of
> > > them, for lack of knowledge of which registers they actually clobber.
> > >
> > > This is even more obscure for the end-user when the compiler inserts
> > > calls to helper functions such as memcpy (some multilibs do use FP
> > > registers to speed it up).
> > >
> > > In the PR, we discussed adding routines in libgcc to save the FP
> > > context and saving only locally-clobbered FP registers, but this seems
> > > to be too much work for the purpose, given that in general such
> > > handlers try to avoid this kind of penalty.
> > > I suspect we would also want new attributes to instruct the compiler
> > > that saving the FP context is not needed.
> > >
> > > In the mean time, emit a warning to suggest re-compiling with
> > > -mgeneral-regs-only. Note that this can lead to errors if the code
> > > uses floating-point and -mfloat-abi=hard, eg:
> > > argument of type 'double' not permitted with -mgeneral-regs-only
> > >
> > > This can be troublesome for the user, but at least this would make
> > > him aware of the latent issue.
> > >
> > > The patch adds several testcases:
> > >
> > > - pr94734-1-hard.c checks that a warning is emitted when using
> > >   -mfloat-abi=hard. Function IRQ_HDLR_Test can make implicit calls to
> > >   runtime floating-point routines (or direct use of FP instructions),
> > >   IRQ_HDLR_Test2 doesn't. We emit a warning in both cases, though.
> > >
> > > - pr94734-1-softfp.c: same as above wih -mfloat-abi=softfp.
> > >
> > > - pr94734-1-soft.c checks that no warning is emitted when using
> > >   -mfloat-abi=soft when the same code as above.
> > >
> > > - pr94734-2.c checks that no warning is emitted when using
> > >   -mgeneral-regs-only.
> > >
> > > - pr94734-3.c checks that no warning is emitted when using
> > >   -mgeneral-regs-only even using float-point data.
> > >
> > > 2020-05-14  Christophe Lyon  
> > >
> > > PR target/94743
> > > gcc/
> > > * config/arm/arm.c (arm_handle_isr_attribute): Warn if
> > > -mgeneral-regs-only is not used.
> > >
> > > gcc/testsuite/
> > > * gcc.misc-tests/arm-isr.c: Add -mgeneral-regs-only.
> > > * gcc.target/arm/empty_fiq_handler.c: Add -mgeneral-regs-only.
> > > * gcc.target/arm/interrupt-1.c: Add -mgeneral-regs-only.
> > > * gcc.target/arm/interrupt-2.c: Add -mgeneral-regs-only.
> > > * gcc.target/arm/pr70830.c: Add -mgeneral-regs-only.
> > > * gcc.target/arm/pr94743-1-hard.c: New test.
> > > * gcc.target/arm/pr94743-1-soft.c: New test.
> > > * gcc.target/arm/pr94743-1-softfp.c: New test.
> > > * gcc.target/arm/pr94743-2.c: New test.
> > > * gcc.target/arm/pr94743-3.c: New test.
> > > ---
> > >  gcc/config/arm/arm.c |  5 
> > >  gcc/testsuite/gcc.misc-tests/arm-isr.c   |  2 ++
> > >  gcc/testsuite/gcc.target/arm/empty_fiq_handler.c |  1 +
> > >  gcc/testsuite/gcc.target/arm/interrupt-1.c   |  2 +-
> > >  gcc/testsuite/gcc.target/arm/interrupt-2.c   |  2 +-
> > >  gcc/testsuite/gcc.target/arm/pr70830.c   |  2 +-
> > >  gcc/testsuite/gcc.target/arm/pr94743-1-hard.c| 29 
> > > 
> > >  gcc/testsuite/gcc.target/arm/pr94743-1-soft.c| 27 
> > > ++
> > >  gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c  | 29 
> > > 
> > >  gcc/testsuite/gcc.target/arm/pr94743-2.c | 22 ++
> > >  gcc/testsuite/gcc.target/arm/pr94743-3.c | 23 +++
> > >  11 files changed, 141 insertions(+), 3 deletions(-)
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-2.c
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-3.c
> > >
> > > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> > > index dda8771..c88de3e 100644
> > > --- a/gcc/config/arm/arm.c
> > > +++ b/gcc/config/arm/arm.c
> > > @@ -7232,6 +7232,11 @@ arm_handle_isr_attribute (tree *node, tree name, 
> > > tree args, int flags,
> > 

Re: [PATCH v2] arm: Warn if IRQ handler is not compiled with -mgeneral-regs-only [PR target/94743]

2020-06-03 Thread Christophe Lyon via Gcc-patches
Ping?
https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545747.html

On Wed, 27 May 2020 at 13:52, Christophe Lyon
 wrote:
>
> Ping?
>
> On Thu, 14 May 2020 at 16:57, Christophe Lyon
>  wrote:
> >
> > The interrupt attribute does not guarantee that the FP registers are
> > saved, which can result in problems difficult to debug.
> >
> > Saving the FP registers and status registers can be a large penalty,
> > so it's probably not desirable to do that all the time.
> >
> > If the handler calls other functions, we'd likely need to save all of
> > them, for lack of knowledge of which registers they actually clobber.
> >
> > This is even more obscure for the end-user when the compiler inserts
> > calls to helper functions such as memcpy (some multilibs do use FP
> > registers to speed it up).
> >
> > In the PR, we discussed adding routines in libgcc to save the FP
> > context and saving only locally-clobbered FP registers, but this seems
> > to be too much work for the purpose, given that in general such
> > handlers try to avoid this kind of penalty.
> > I suspect we would also want new attributes to instruct the compiler
> > that saving the FP context is not needed.
> >
> > In the mean time, emit a warning to suggest re-compiling with
> > -mgeneral-regs-only. Note that this can lead to errors if the code
> > uses floating-point and -mfloat-abi=hard, eg:
> > argument of type 'double' not permitted with -mgeneral-regs-only
> >
> > This can be troublesome for the user, but at least this would make
> > him aware of the latent issue.
> >
> > The patch adds several testcases:
> >
> > - pr94734-1-hard.c checks that a warning is emitted when using
> >   -mfloat-abi=hard. Function IRQ_HDLR_Test can make implicit calls to
> >   runtime floating-point routines (or direct use of FP instructions),
> >   IRQ_HDLR_Test2 doesn't. We emit a warning in both cases, though.
> >
> > - pr94734-1-softfp.c: same as above wih -mfloat-abi=softfp.
> >
> > - pr94734-1-soft.c checks that no warning is emitted when using
> >   -mfloat-abi=soft when the same code as above.
> >
> > - pr94734-2.c checks that no warning is emitted when using
> >   -mgeneral-regs-only.
> >
> > - pr94734-3.c checks that no warning is emitted when using
> >   -mgeneral-regs-only even using float-point data.
> >
> > 2020-05-14  Christophe Lyon  
> >
> > PR target/94743
> > gcc/
> > * config/arm/arm.c (arm_handle_isr_attribute): Warn if
> > -mgeneral-regs-only is not used.
> >
> > gcc/testsuite/
> > * gcc.misc-tests/arm-isr.c: Add -mgeneral-regs-only.
> > * gcc.target/arm/empty_fiq_handler.c: Add -mgeneral-regs-only.
> > * gcc.target/arm/interrupt-1.c: Add -mgeneral-regs-only.
> > * gcc.target/arm/interrupt-2.c: Add -mgeneral-regs-only.
> > * gcc.target/arm/pr70830.c: Add -mgeneral-regs-only.
> > * gcc.target/arm/pr94743-1-hard.c: New test.
> > * gcc.target/arm/pr94743-1-soft.c: New test.
> > * gcc.target/arm/pr94743-1-softfp.c: New test.
> > * gcc.target/arm/pr94743-2.c: New test.
> > * gcc.target/arm/pr94743-3.c: New test.
> > ---
> >  gcc/config/arm/arm.c |  5 
> >  gcc/testsuite/gcc.misc-tests/arm-isr.c   |  2 ++
> >  gcc/testsuite/gcc.target/arm/empty_fiq_handler.c |  1 +
> >  gcc/testsuite/gcc.target/arm/interrupt-1.c   |  2 +-
> >  gcc/testsuite/gcc.target/arm/interrupt-2.c   |  2 +-
> >  gcc/testsuite/gcc.target/arm/pr70830.c   |  2 +-
> >  gcc/testsuite/gcc.target/arm/pr94743-1-hard.c| 29 
> > 
> >  gcc/testsuite/gcc.target/arm/pr94743-1-soft.c| 27 
> > ++
> >  gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c  | 29 
> > 
> >  gcc/testsuite/gcc.target/arm/pr94743-2.c | 22 ++
> >  gcc/testsuite/gcc.target/arm/pr94743-3.c | 23 +++
> >  11 files changed, 141 insertions(+), 3 deletions(-)
> >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c
> >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c
> >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c
> >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-2.c
> >  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-3.c
> >
> > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> > index dda8771..c88de3e 100644
> > --- a/gcc/config/arm/arm.c
> > +++ b/gcc/config/arm/arm.c
> > @@ -7232,6 +7232,11 @@ arm_handle_isr_attribute (tree *node, tree name, 
> > tree args, int flags,
> >name);
> >   *no_add_attrs = true;
> > }
> > +  else if (TARGET_VFP_BASE)
> > +   {
> > + warning (OPT_Wattributes, "FP registers might be clobbered 
> > despite %qE attribute: compile with -mgeneral-regs-only",
> > +  name);
> > +   }
> >/* FIXME: the argument if any is checked for type attributes;
> >

Re: [PATCH v2] arm: Warn if IRQ handler is not compiled with -mgeneral-regs-only [PR target/94743]

2020-05-27 Thread Christophe Lyon via Gcc-patches
Ping?

On Thu, 14 May 2020 at 16:57, Christophe Lyon
 wrote:
>
> The interrupt attribute does not guarantee that the FP registers are
> saved, which can result in problems difficult to debug.
>
> Saving the FP registers and status registers can be a large penalty,
> so it's probably not desirable to do that all the time.
>
> If the handler calls other functions, we'd likely need to save all of
> them, for lack of knowledge of which registers they actually clobber.
>
> This is even more obscure for the end-user when the compiler inserts
> calls to helper functions such as memcpy (some multilibs do use FP
> registers to speed it up).
>
> In the PR, we discussed adding routines in libgcc to save the FP
> context and saving only locally-clobbered FP registers, but this seems
> to be too much work for the purpose, given that in general such
> handlers try to avoid this kind of penalty.
> I suspect we would also want new attributes to instruct the compiler
> that saving the FP context is not needed.
>
> In the mean time, emit a warning to suggest re-compiling with
> -mgeneral-regs-only. Note that this can lead to errors if the code
> uses floating-point and -mfloat-abi=hard, eg:
> argument of type 'double' not permitted with -mgeneral-regs-only
>
> This can be troublesome for the user, but at least this would make
> him aware of the latent issue.
>
> The patch adds several testcases:
>
> - pr94734-1-hard.c checks that a warning is emitted when using
>   -mfloat-abi=hard. Function IRQ_HDLR_Test can make implicit calls to
>   runtime floating-point routines (or direct use of FP instructions),
>   IRQ_HDLR_Test2 doesn't. We emit a warning in both cases, though.
>
> - pr94734-1-softfp.c: same as above wih -mfloat-abi=softfp.
>
> - pr94734-1-soft.c checks that no warning is emitted when using
>   -mfloat-abi=soft when the same code as above.
>
> - pr94734-2.c checks that no warning is emitted when using
>   -mgeneral-regs-only.
>
> - pr94734-3.c checks that no warning is emitted when using
>   -mgeneral-regs-only even using float-point data.
>
> 2020-05-14  Christophe Lyon  
>
> PR target/94743
> gcc/
> * config/arm/arm.c (arm_handle_isr_attribute): Warn if
> -mgeneral-regs-only is not used.
>
> gcc/testsuite/
> * gcc.misc-tests/arm-isr.c: Add -mgeneral-regs-only.
> * gcc.target/arm/empty_fiq_handler.c: Add -mgeneral-regs-only.
> * gcc.target/arm/interrupt-1.c: Add -mgeneral-regs-only.
> * gcc.target/arm/interrupt-2.c: Add -mgeneral-regs-only.
> * gcc.target/arm/pr70830.c: Add -mgeneral-regs-only.
> * gcc.target/arm/pr94743-1-hard.c: New test.
> * gcc.target/arm/pr94743-1-soft.c: New test.
> * gcc.target/arm/pr94743-1-softfp.c: New test.
> * gcc.target/arm/pr94743-2.c: New test.
> * gcc.target/arm/pr94743-3.c: New test.
> ---
>  gcc/config/arm/arm.c |  5 
>  gcc/testsuite/gcc.misc-tests/arm-isr.c   |  2 ++
>  gcc/testsuite/gcc.target/arm/empty_fiq_handler.c |  1 +
>  gcc/testsuite/gcc.target/arm/interrupt-1.c   |  2 +-
>  gcc/testsuite/gcc.target/arm/interrupt-2.c   |  2 +-
>  gcc/testsuite/gcc.target/arm/pr70830.c   |  2 +-
>  gcc/testsuite/gcc.target/arm/pr94743-1-hard.c| 29 
> 
>  gcc/testsuite/gcc.target/arm/pr94743-1-soft.c| 27 ++
>  gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c  | 29 
> 
>  gcc/testsuite/gcc.target/arm/pr94743-2.c | 22 ++
>  gcc/testsuite/gcc.target/arm/pr94743-3.c | 23 +++
>  11 files changed, 141 insertions(+), 3 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-2.c
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-3.c
>
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index dda8771..c88de3e 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -7232,6 +7232,11 @@ arm_handle_isr_attribute (tree *node, tree name, tree 
> args, int flags,
>name);
>   *no_add_attrs = true;
> }
> +  else if (TARGET_VFP_BASE)
> +   {
> + warning (OPT_Wattributes, "FP registers might be clobbered despite 
> %qE attribute: compile with -mgeneral-regs-only",
> +  name);
> +   }
>/* FIXME: the argument if any is checked for type attributes;
>  should it be checked for decl ones?  */
>  }
> diff --git a/gcc/testsuite/gcc.misc-tests/arm-isr.c 
> b/gcc/testsuite/gcc.misc-tests/arm-isr.c
> index 737f9ff..9eff52c 100644
> --- a/gcc/testsuite/gcc.misc-tests/arm-isr.c
> +++ b/gcc/testsuite/gcc.misc-tests/arm-isr.c
> @@ -1,3 +1,5 @@
> +/* { dg-options "-mgeneral-regs-only" } */

[PATCH v2] arm: Warn if IRQ handler is not compiled with -mgeneral-regs-only [PR target/94743]

2020-05-14 Thread Christophe Lyon via Gcc-patches
The interrupt attribute does not guarantee that the FP registers are
saved, which can result in problems difficult to debug.

Saving the FP registers and status registers can be a large penalty,
so it's probably not desirable to do that all the time.

If the handler calls other functions, we'd likely need to save all of
them, for lack of knowledge of which registers they actually clobber.

This is even more obscure for the end-user when the compiler inserts
calls to helper functions such as memcpy (some multilibs do use FP
registers to speed it up).

In the PR, we discussed adding routines in libgcc to save the FP
context and saving only locally-clobbered FP registers, but this seems
to be too much work for the purpose, given that in general such
handlers try to avoid this kind of penalty.
I suspect we would also want new attributes to instruct the compiler
that saving the FP context is not needed.

In the mean time, emit a warning to suggest re-compiling with
-mgeneral-regs-only. Note that this can lead to errors if the code
uses floating-point and -mfloat-abi=hard, eg:
argument of type 'double' not permitted with -mgeneral-regs-only

This can be troublesome for the user, but at least this would make
him aware of the latent issue.

The patch adds several testcases:

- pr94734-1-hard.c checks that a warning is emitted when using
  -mfloat-abi=hard. Function IRQ_HDLR_Test can make implicit calls to
  runtime floating-point routines (or direct use of FP instructions),
  IRQ_HDLR_Test2 doesn't. We emit a warning in both cases, though.

- pr94734-1-softfp.c: same as above wih -mfloat-abi=softfp.

- pr94734-1-soft.c checks that no warning is emitted when using
  -mfloat-abi=soft when the same code as above.

- pr94734-2.c checks that no warning is emitted when using
  -mgeneral-regs-only.

- pr94734-3.c checks that no warning is emitted when using
  -mgeneral-regs-only even using float-point data.

2020-05-14  Christophe Lyon  

PR target/94743
gcc/
* config/arm/arm.c (arm_handle_isr_attribute): Warn if
-mgeneral-regs-only is not used.

gcc/testsuite/
* gcc.misc-tests/arm-isr.c: Add -mgeneral-regs-only.
* gcc.target/arm/empty_fiq_handler.c: Add -mgeneral-regs-only.
* gcc.target/arm/interrupt-1.c: Add -mgeneral-regs-only.
* gcc.target/arm/interrupt-2.c: Add -mgeneral-regs-only.
* gcc.target/arm/pr70830.c: Add -mgeneral-regs-only.
* gcc.target/arm/pr94743-1-hard.c: New test.
* gcc.target/arm/pr94743-1-soft.c: New test.
* gcc.target/arm/pr94743-1-softfp.c: New test.
* gcc.target/arm/pr94743-2.c: New test.
* gcc.target/arm/pr94743-3.c: New test.
---
 gcc/config/arm/arm.c |  5 
 gcc/testsuite/gcc.misc-tests/arm-isr.c   |  2 ++
 gcc/testsuite/gcc.target/arm/empty_fiq_handler.c |  1 +
 gcc/testsuite/gcc.target/arm/interrupt-1.c   |  2 +-
 gcc/testsuite/gcc.target/arm/interrupt-2.c   |  2 +-
 gcc/testsuite/gcc.target/arm/pr70830.c   |  2 +-
 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c| 29 
 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c| 27 ++
 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c  | 29 
 gcc/testsuite/gcc.target/arm/pr94743-2.c | 22 ++
 gcc/testsuite/gcc.target/arm/pr94743-3.c | 23 +++
 11 files changed, 141 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-hard.c
 create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-soft.c
 create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-1-softfp.c
 create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/pr94743-3.c

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index dda8771..c88de3e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -7232,6 +7232,11 @@ arm_handle_isr_attribute (tree *node, tree name, tree 
args, int flags,
   name);
  *no_add_attrs = true;
}
+  else if (TARGET_VFP_BASE)
+   {
+ warning (OPT_Wattributes, "FP registers might be clobbered despite 
%qE attribute: compile with -mgeneral-regs-only",
+  name);
+   }
   /* FIXME: the argument if any is checked for type attributes;
 should it be checked for decl ones?  */
 }
diff --git a/gcc/testsuite/gcc.misc-tests/arm-isr.c 
b/gcc/testsuite/gcc.misc-tests/arm-isr.c
index 737f9ff..9eff52c 100644
--- a/gcc/testsuite/gcc.misc-tests/arm-isr.c
+++ b/gcc/testsuite/gcc.misc-tests/arm-isr.c
@@ -1,3 +1,5 @@
+/* { dg-options "-mgeneral-regs-only" } */
+
 extern void abort ();
 extern void exit (int);
 
diff --git a/gcc/testsuite/gcc.target/arm/empty_fiq_handler.c 
b/gcc/testsuite/gcc.target/arm/empty_fiq_handler.c
index 8313f21..6911ffc 100644
--- a/gcc/testsuite/gcc.target/arm/empty_fiq_handler.c
+++