
FPSCR and FPEXC will be stored in FPStatusRegs, after GPRCS2 has been saved. - GPRCS1 - GPRCS2 - FPStatusRegs (new) - DPRCS - GPRCS3 - DPRCS2 FPSCR is present on all targets with a VFP, but the FPEXC register is not present on Cortex-M devices, so different amounts of bytes are being pushed onto the stack depending on our target, which would affect alignment for subsequent saves. DPRCS1 will sum up all previous bytes that were saved, and will emit extra instructions to ensure that its alignment is correct. My assumption is that if DPRCS1 is able to correct its alignment to be correct, then all subsequent saves will also have correct alignment. Avoid annotating the saving of FPSCR and FPEXC for functions marked with the interrupt_save_fp attribute, even though this is done as part of frame setup. Since these are status registers, there really is no viable way of annotating this. Since these aren't GPRs or DPRs, they can't be used with .save or .vsave directives. Instead, just record that the intermediate registers r4 and r5 are saved to the stack again. Co-authored-by: Jake Vossen <jake@vossen.dev> Co-authored-by: Alan Phipps <a-phipps@ti.com>
27 lines
1.4 KiB
C
27 lines
1.4 KiB
C
// RUN: %clang_cc1 %s -triple arm-none-eabi -verify -fsyntax-only
|
|
// RUN: %clang_cc1 %s -triple arm-none-eabi -target-feature +vfp2 -verify -fsyntax-only
|
|
|
|
|
|
#ifdef __ARM_FP
|
|
__attribute__((interrupt("IRQ"))) void float_irq(void); // expected-warning {{interrupt service routine with vfp enabled may clobber the interruptee's vfp state; consider using the `interrupt_save_fp` attribute to prevent this behavior}}
|
|
#else // !defined(__ARM_FP)
|
|
__attribute__((interrupt("irq"))) void foo1(void) {} // expected-warning {{'interrupt' attribute argument not supported: irq}}
|
|
__attribute__((interrupt(IRQ))) void foo(void) {} // expected-error {{'interrupt' attribute requires a string}}
|
|
__attribute__((interrupt("IRQ", 1))) void foo2(void) {} // expected-error {{'interrupt' attribute takes no more than 1 argument}}
|
|
__attribute__((interrupt("IRQ"))) void foo3(void) {}
|
|
__attribute__((interrupt("FIQ"))) void foo4(void) {}
|
|
__attribute__((interrupt("SWI"))) void foo5(void) {}
|
|
__attribute__((interrupt("ABORT"))) void foo6(void) {}
|
|
__attribute__((interrupt("UNDEF"))) void foo7(void) {}
|
|
__attribute__((interrupt)) void foo8(void) {}
|
|
__attribute__((interrupt())) void foo9(void) {}
|
|
__attribute__((interrupt(""))) void foo10(void) {}
|
|
|
|
__attribute__((interrupt("IRQ"))) void callee(void) {}
|
|
|
|
void caller(void)
|
|
{
|
|
callee(); // expected-error {{interrupt service routine cannot be called directly}}
|
|
}
|
|
#endif // __ARM_FP
|