summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/frv/all-accs-1.c
blob: cb4232b3c3bebdecad27458635b19d9fe50e624a (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
/* Check that ACCs and ACCGs are treated as global variables even if
   media.h isn't included.  */
/* { dg-do run } */
extern void abort (void);
extern void exit (int);

void
set ()
{
#define SET(X) __MWTACC (X, (X) | 0x100), __MWTACCG (X, X)
  SET (0);
  SET (1);
  SET (2);
  SET (3);
#if defined (__CPU_FR450__)
  SET (8);
  SET (9);
  SET (10);
  SET (11);
#elif __FRV_ACC__ > 4
  SET (4);
  SET (5);
  SET (6);
  SET (7);
#endif
#undef SET
}

void
check ()
{
  int diff1, diff2;

  diff1 = diff2 = 0;

#define CHECK(X) \
	(diff1 |= (__MRDACC (X) ^ (X | 0x100)), \
	 diff2 |= (__MRDACCG (X) ^ X))
  CHECK (0);
  CHECK (1);
  CHECK (2);
  CHECK (3);
#if defined (__CPU_FR450__)
  CHECK (8);
  CHECK (9);
  CHECK (10);
  CHECK (11);
#elif __FRV_ACC__ > 4
  CHECK (4);
  CHECK (5);
  CHECK (6);
  CHECK (7);
#endif
#undef CHECK
  if ((diff1 | diff2) != 0)
    abort ();
}

int
main ()
{
  set ();
  check ();
  exit (0);
}