1 /* Verify that unwinding can find SPE registers in signal frames. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do run { target { powerpc*-*-linux* && powerpc_spe } } } */
4 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
15 typedef int v2si __attribute__((__vector_size__(8)));
17 v2si v1 = { 123, 234 };
18 v2si v2 = { 345, 456 };
20 static _Unwind_Reason_Code
21 force_unwind_stop (int version, _Unwind_Action actions,
22 _Unwind_Exception_Class exc_class,
23 struct _Unwind_Exception *exc_obj,
24 struct _Unwind_Context *context,
28 if (actions & _UA_END_OF_STACK)
30 if (_Unwind_GetGR (context, 1215) == 123)
32 return _URC_NO_REASON;
35 static void force_unwind ()
37 struct _Unwind_Exception *exc = malloc (sizeof (*exc));
38 memset (&exc->exception_class, 0, sizeof (exc->exception_class));
39 exc->exception_cleanup = 0;
41 #ifndef __USING_SJLJ_EXCEPTIONS__
42 _Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
44 _Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
50 static void counter (void *p __attribute__((unused)))
55 static void handler (void *p __attribute__((unused)))
64 static int __attribute__((noinline)) fn5 ()
66 char dummy __attribute__((cleanup (counter)));
71 static void fn4 (int sig)
73 char dummy __attribute__((cleanup (counter)));
74 /* Clobber high part without compiler's knowledge so the only saved
75 copy is from the signal frame. */
76 asm volatile ("evmergelo 15,15,15");
86 static int __attribute__((noinline)) fn2 ()
88 register v2si r15 asm("r15");
90 asm volatile ("" : "+r" (r15));
96 static int __attribute__((noinline)) fn1 ()
98 signal (SIGSEGV, fn4);
104 static int __attribute__((noinline)) fn0 ()
106 char dummy __attribute__((cleanup (handler)));