armv7m-1.c: New test.
gcc/testsuite/ * g++.dg/other/armv7m-1.c: New test. From-SVN: r189784
This commit is contained in:
parent
afa6353225
commit
87d84e1eb6
@ -1,3 +1,7 @@
|
||||
2012-07-23 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* g++.dg/other/armv7m-1.c: New test.
|
||||
|
||||
2012-07-23 Julian Brown <julian@codesourcery.com>
|
||||
|
||||
* gcc.c-torture/execute/20101011-1.c (__aeabi_idiv0): Define for
|
||||
|
69
gcc/testsuite/g++.dg/other/armv7m-1.C
Normal file
69
gcc/testsuite/g++.dg/other/armv7m-1.C
Normal file
@ -0,0 +1,69 @@
|
||||
/* { dg-do run { target arm*-*-* } } */
|
||||
/* Test Armv7m interrupt routines. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __ARM_ARCH_7M__
|
||||
void __attribute__((interrupt))
|
||||
foo(void)
|
||||
{
|
||||
long long n;
|
||||
long p;
|
||||
asm volatile ("" : "=r" (p) : "0" (&n));
|
||||
if (p & 4)
|
||||
abort ();
|
||||
return;
|
||||
}
|
||||
|
||||
void __attribute__((interrupt))
|
||||
bar(void)
|
||||
{
|
||||
throw 42;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
int before;
|
||||
int after;
|
||||
volatile register int sp asm("sp");
|
||||
|
||||
asm volatile ("mov %0, sp\n"
|
||||
"blx %2\n"
|
||||
"mov %1, sp\n"
|
||||
: "=&r" (before), "=r" (after) : "r" (foo)
|
||||
: "memory", "cc", "r0", "r1", "r2", "r3", "ip", "lr");
|
||||
if (before != after)
|
||||
abort();
|
||||
asm volatile ("mov %0, sp\n"
|
||||
"sub sp, sp, #4\n"
|
||||
"blx %2\n"
|
||||
"add sp, sp, #4\n"
|
||||
"mov %1, sp\n"
|
||||
: "=&r" (before), "=r" (after) : "r" (foo)
|
||||
: "memory", "cc", "r0", "r1", "r2", "r3", "ip", "lr");
|
||||
if (before != after)
|
||||
abort();
|
||||
before = sp;
|
||||
try
|
||||
{
|
||||
bar();
|
||||
}
|
||||
catch (int i)
|
||||
{
|
||||
if (i != 42)
|
||||
abort();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
if (before != sp)
|
||||
abort();
|
||||
exit(0);
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user