summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/ia64/fpreg-1.c
blob: 8c9e21d7c7805e40326272705b982e3350a95c17 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Test permitted and invalid uses of __fpreg.  */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "" } */

__float80 f80;
double d;
/* Default initialized __fpreg is OK.  */
__fpreg fpreg, fpreg2;
/* But explicitly zero-initialized is an invalid conversion.  */
__fpreg fi = 0; /* { dg-error "invalid conversion to '__fpreg'" } */

__fpreg f0 (__fpreg);
int f1 (__float80);

/* __fpreg in a structure is OK.  */
struct s {
  __float80 b;
  __fpreg a;
} x;

void
f (void)
{
  __fpreg *p;
  /* Valid operations.  */
  fpreg = fpreg2;
  fpreg2 = (__fpreg) fpreg;
  fpreg = f0 (fpreg2);
  fpreg = +fpreg2;
  p = &fpreg;
  (void) fpreg;
  fpreg = x.a;
  fpreg2 = (struct s) { 0 }.a;
  fpreg = (d ? fpreg : fpreg2);
  d = sizeof (fpreg);
  (void)(fpreg, fpreg);
  /* Invalid operations.  */
  ++fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  --fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg++; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg--; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = -fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = ~fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = !fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = *fpreg; /* { dg-error "invalid type argument" } */
  if (fpreg) /* { dg-error "invalid operation on '__fpreg'" } */
    return;
  d = fpreg; /* { dg-error "invalid conversion from '__fpreg'" } */
  d = (double) fpreg; /* { dg-error "invalid conversion from '__fpreg'" } */
  fpreg = (__fpreg) d; /* { dg-error "invalid conversion to '__fpreg'" } */
  fpreg = fpreg * fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg / fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg % fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg + fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg - fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg << fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = fpreg >> fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg < fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg > fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg <= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg >= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg == fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg != fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg & fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg ^ fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg | fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg && fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = fpreg || fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  d = (fpreg ? 1 : 2); /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg = (d ? fpreg : d); /* { dg-error "invalid conversion to '__fpreg'" } */
  fpreg *= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg /= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg %= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg += fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg -= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg <<= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg >>= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg &= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg ^= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
  fpreg |= fpreg; /* { dg-error "invalid operation on '__fpreg'" } */
}