OSDN Git Service

Revert delta 190174
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / frv / all-read-write-1.c
1 /* { dg-do run } */
2 extern void abort (void);
3 extern void exit (int);
4
5 volatile unsigned long long x[2];
6
7 int main ()
8 {
9   volatile char *addr = (volatile char *) &x[0];
10
11   x[0] = ~0ULL;
12   x[1] = ~0ULL;
13   __builtin_write64 (addr, 0x1122334455667788ULL);
14   __builtin_write32 (addr + 8, 0x12345678);
15   __builtin_write16 (addr + 12, 0xaabb);
16   __builtin_write8 (addr + 14, 0xcc);
17
18   if (x[0] != 0x1122334455667788ULL
19       || x[1] != 0x12345678aabbccffULL
20       || __builtin_read8 (addr) != 0x11
21       || __builtin_read16 (addr + 2) != 0x3344
22       || __builtin_read32 (addr + 4) != 0x55667788
23       || __builtin_read64 (addr + 8) != 0x12345678aabbccffULL)
24     abort ();
25
26   __builtin_write64 (addr, 0);
27   __builtin_write32 (addr + 8, 0);
28   __builtin_write16 (addr + 12, 0);
29   __builtin_write8 (addr + 14, 0);
30   if (x[0] != 0 || x[1] != 0xff)
31     abort ();
32
33   exit (0);
34 }