1 // Test whether call saved float are restored properly for O32 ABI
2 // { dg-do run { target { { { mips*-*-linux* } && hard_float } && { ! mips64 } } } }
3 // { dg-options "-O2" }
4 
5 void __attribute__((noinline))
bar(void)6 bar (void)
7 {
8   throw 1;
9 }
10 
11 void __attribute__((noinline))
foo(void)12 foo (void)
13 {
14   register double f20 __asm__ ("f20") = 0.0;
15   register double f22 __asm__ ("f22") = 0.0;
16   register double f24 __asm__ ("f24") = 0.0;
17   register double f26 __asm__ ("f26") = 0.0;
18   register double f28 __asm__ ("f28") = 0.0;
19   register double f30 __asm__ ("f30") = 0.0;
20   __asm__ __volatile__("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30));
21   bar ();
22 }
23 
24 int
main(void)25 main (void)
26 {
27   register double f20 __asm__ ("f20") = 12.0;
28   register double f22 __asm__ ("f22") = 13.0;
29   register double f24 __asm__ ("f24") = 14.0;
30   register double f26 __asm__ ("f26") = 15.0;
31   register double f28 __asm__ ("f28") = 16.0;
32   register double f30 __asm__ ("f30") = 17.0;
33 
34   try
35     {
36       foo ();
37     }
38   catch (...)
39     {
40       __asm__ ("":"+f"(f20),"+f"(f22),"+f"(f24),"+f"(f26),"+f"(f30));
41     }
42 
43   if (f20 != 12.0 || f22 != 13.0 || f24 != 14.0
44       || f26 != 15.0 || f28 != 16.0 || f30 != 17.0)
45     __builtin_abort ();
46   return 0;
47 }
48