summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sparc/20001013-1.c
blob: 891ccab0a34be9819555d21793a4cabe7ce7ad69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_hw } */
/* { dg-options "-O2 -mcpu=ultrasparc -mvis" } */

extern void abort (void);
extern void exit (int);

int l;

int baz (double x)
{
  return l == 0;
}

double bar (double x)
{
  return 1.0;
}

double foo (double x)
{
  if (l == -1 || baz (x)) return x;
  if (x < 0.0)
    return bar (x);
  else
    return 0.0;
}

union {
  double d;
  long long l;
} x = { l: 0x7ff8000000000000LL }, y;

main ()
{
  unsigned int fsr = 0;
  __asm __volatile ("ld %0, %%fsr" : : "m" (fsr));
  y.d = foo (x.d);
  __asm __volatile ("st %%fsr, %0" : "=m" (fsr));
  if (x.l != y.l || (fsr & 0x3ff))
    abort ();
  exit (0);
}