| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target ultrasparc_hw } */ |
| 3 |
/* { dg-options "-O2 -mcpu=ultrasparc -mvis" } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
extern void exit (int); |
| 7 |
|
| 8 |
int l; |
| 9 |
|
| 10 |
int baz (double x) |
| 11 |
{ |
| 12 |
return l == 0; |
| 13 |
} |
| 14 |
|
| 15 |
double bar (double x) |
| 16 |
{ |
| 17 |
return 1.0; |
| 18 |
} |
| 19 |
|
| 20 |
double foo (double x) |
| 21 |
{ |
| 22 |
if (l == -1 || baz (x)) return x; |
| 23 |
if (x < 0.0) |
| 24 |
return bar (x); |
| 25 |
else |
| 26 |
return 0.0; |
| 27 |
} |
| 28 |
|
| 29 |
union { |
| 30 |
double d; |
| 31 |
long long l; |
| 32 |
} x = { l: 0x7ff8000000000000LL }, y; |
| 33 |
|
| 34 |
int main () |
| 35 |
{ |
| 36 |
unsigned int fsr = 0; |
| 37 |
__asm __volatile ("ld %0, %%fsr" : : "m" (fsr)); |
| 38 |
y.d = foo (x.d); |
| 39 |
__asm __volatile ("st %%fsr, %0" : "=m" (fsr)); |
| 40 |
if (x.l != y.l || (fsr & 0x3ff)) |
| 41 |
abort (); |
| 42 |
exit (0); |
| 43 |
} |