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? */
}
+/* { dg-options "-mgeneral-regs-only" } */
+
extern void abort ();
extern void exit (int);
/* { dg-do compile } */
/* { dg-skip-if "" { ! arm_cortex_m } { "-mthumb" } } */
+/* { dg-options "-mgeneral-regs-only" } */
/* Below code used to trigger an ICE due to missing constraints for
sp = fp + cst pattern. */
__attribute__ ((interrupt)). */
/* { dg-do assemble } */
/* { dg-require-effective-target arm_nothumb } */
-/* { dg-options "-O0 -marm -save-temps" } */
+/* { dg-options "-mgeneral-regs-only -O0 -marm -save-temps" } */
/* This test is not valid when -mthumb. */
extern void bar (int);
__attribute__ ((interrupt)). */
/* { dg-do assemble } */
/* { dg-require-effective-target arm_nothumb } */
-/* { dg-options "-O1 -marm -save-temps" } */
+/* { dg-options "-mgeneral-regs-only -O1 -marm -save-temps" } */
/* This test is not valid when -mthumb. */
extern void bar (int);
/* PR target/70830. */
/* { dg-do assemble } */
/* { dg-require-effective-target arm_arm_ok } */
-/* { dg-options "-Os -marm -save-temps" } */
+/* { dg-options "-mgeneral-regs-only -Os -marm -save-temps" } */
/* This test is not valid when -mthumb. */
--- /dev/null
+/* PR target/94743 */
+/* { dg-do compile } */
+/* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } {"-mfloat-abi=hard" } } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-add-options arm_vfp } */
+/* Make sure with use -mfloat-abi=hard. */
+/* { dg-additional-options "-mfloat-abi=hard" } */
+
+/* Check that we emit a warning when compiling an IRQ handler without
+ -mgeneral-regs-only. */
+typedef struct {
+ double fpdata[32];
+} dummy_t;
+
+dummy_t global_d;
+dummy_t global_d1;
+
+/* This function may clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test(void)
+{ /* { dg-warning { FP registers might be clobbered despite 'interrupt' attribute: compile with -mgeneral-regs-only} "" { target *-*-* } . } */
+ global_d.fpdata[3] += global_d.fpdata[3] * global_d1.fpdata[3];
+}
+
+/* This function does not need to clobber VFP registers. */
+/* Do we want to emit a (useless?) warning? */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test2(void)
+{ /* { dg-warning { FP registers might be clobbered despite 'interrupt' attribute: compile with -mgeneral-regs-only} "" { target *-*-* } . } */
+ global_d.fpdata[3] = 1.0;
+}
--- /dev/null
+/* PR target/94743 */
+/* { dg-do compile } */
+/* Thumb1 mode not supported for interrupt routines. */
+/* { dg-require-effective-target arm32 } */
+/* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } {"-mfloat-abi=soft" } } */
+/* { dg-options "-mfloat-abi=soft" } */
+
+/* Check that we do not emit a warning when compiling an IRQ handler without
+ -mgeneral-regs-only with -mfloat-abi=soft. */
+typedef struct {
+ double fpdata[32];
+} dummy_t;
+
+dummy_t global_d;
+dummy_t global_d1;
+
+/* This function may clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test(void)
+{
+ global_d.fpdata[3] += global_d.fpdata[3] * global_d1.fpdata[3];
+}
+
+/* This function does not need to clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test2(void)
+{
+ global_d.fpdata[3] = 1.0;
+}
--- /dev/null
+/* PR target/94743 */
+/* { dg-do compile } */
+/* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } {"-mfloat-abi=softfp" } } */
+/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-add-options arm_vfp } */
+/* Make sure with use -mfloat-abi=softfp. */
+/* { dg-additional-options "-mfloat-abi=softfp" } */
+
+/* Check that we emit a warning when compiling an IRQ handler without
+ -mgeneral-regs-only. */
+typedef struct {
+ double fpdata[32];
+} dummy_t;
+
+dummy_t global_d;
+dummy_t global_d1;
+
+/* This function may clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test(void)
+{ /* { dg-warning { FP registers might be clobbered despite 'interrupt' attribute: compile with -mgeneral-regs-only} "" { target *-*-* } . } */
+ global_d.fpdata[3] += global_d.fpdata[3] * global_d1.fpdata[3];
+}
+
+/* This function does not need to clobber VFP registers. */
+/* Do we want to emit a (useless?) warning? */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test2(void)
+{ /* { dg-warning { FP registers might be clobbered despite 'interrupt' attribute: compile with -mgeneral-regs-only} "" { target *-*-* } . } */
+ global_d.fpdata[3] = 1.0;
+}
--- /dev/null
+/* PR target/94743 */
+/* { dg-do compile } */
+/* Thumb1 mode not supported for interrupt routines. */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-mgeneral-regs-only" } */
+
+/* Check that we do not emit a warning when compiling an IRQ handler
+ with -mgeneral-regs-only. */
+typedef struct {
+ /* Do not use floating-point types, which are not compatible with
+ -mgeneral-regs-only under -mfloat-abi=hard */
+ int fpdata[32];
+} dummy_t;
+
+dummy_t global_d;
+dummy_t global_d1;
+
+/* This function does not clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test(void)
+{
+ global_d.fpdata[3] += global_d.fpdata[3] * global_d1.fpdata[3];
+}
--- /dev/null
+/* PR target/94743 */
+/* { dg-do compile } */
+/* Thumb1 mode not supported for interrupt routines. */
+/* { dg-require-effective-target arm32 } */
+/* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } {"-mfloat-abi=soft" } } */
+/* { dg-options "-mgeneral-regs-only -mfloat-abi=soft" } */
+
+/* Check that we do not emit a warning when compiling an IRQ handler
+ with -mgeneral-regs-only even when using floating-point data. */
+typedef struct {
+ /* Since we use -mfloat=abi=soft, this will generate calls to
+ libgcc, but won't clobber VFP registers. */
+ double fpdata[32];
+} dummy_t;
+
+dummy_t global_d;
+dummy_t global_d1;
+
+/* This function does not clobber VFP registers. */
+__attribute__ ((interrupt("IRQ"))) void IRQ_HDLR_Test(void)
+{
+ global_d.fpdata[3] += global_d.fpdata[3] * global_d1.fpdata[3];
+}