2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / 20001013-1.c
blob163a262ebe895ede1ac95bb5ea3dae7f0410fe90
1 /* ??? It'd be nice to run this for sparc32 as well, if we could know
2 for sure that we're on an ultrasparc, rather than an older cpu. */
3 /* { dg-do run { target sparcv9-*-* sparc64-*-* } } */
4 /* { dg-options "-O2 -m32 -mcpu=ultrasparc -mvis" } */
6 int l;
8 int baz (double x)
10 return l == 0;
13 double bar (double x)
15 return 1.0;
18 double foo (double x)
20 if (l == -1 || baz (x)) return x;
21 if (x < 0.0)
22 return bar (x);
23 else
24 return 0.0;
27 union {
28 double d;
29 long long l;
30 } x = { l: 0x7ff8000000000000LL }, y;
32 main ()
34 unsigned int fsr = 0;
35 __asm __volatile ("ld %0, %%fsr" : : "m" (fsr));
36 y.d = foo (x.d);
37 __asm __volatile ("st %%fsr, %0" : "=m" (fsr));
38 if (x.l != y.l || (fsr & 0x3ff))
39 abort ();
40 exit (0);