OSDN Git Service

2008-07-28 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr35045.c
1 /* { dg-do run } */
2 /* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
3 /* { dg-options "-O2 -fgcse-after-reload" } */
4
5 extern void abort (void);
6
7 __attribute__((noinline)) __complex__ float
8 give_neg1 (void)
9 {
10   __complex__ float res;
11   __real__ res = -1.0;
12   __imag__ res = 1.0;
13   return res;
14 }
15
16 __attribute__((noinline)) __complex__ float
17 mycacoshf (__complex__ float x)
18 {
19   __complex__ float res;
20   res = give_neg1 ();
21
22   /* We have to use the positive branch.  */
23   if (__real__ res < 0.0)
24     {
25       unsigned a,b,c,d,e,f;
26       res = -res; 
27       asm __volatile__ ("" : "=r" (a), "=r" (b), "=r" (c), "=r" (d), "=r" (e), "=r" (f));
28     }
29   return res;
30 }
31
32 int main()
33 {
34   __complex__ float res = mycacoshf(1.0);
35   if (__imag__ res >= 0.0)
36     abort();
37   return 0;
38 }