OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [mips/] [atomic-memory-1.c] - Blame information for rev 321

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 321 jeremybenn
/* { dg-do run } */
2
 
3
/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
4
 
5
extern void abort (void);
6
extern void exit (int);
7
 
8
NOMIPS16 int main ()
9
{
10
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
11
  unsigned v = 0;
12
  __sync_synchronize ();
13
 
14
  if (!__sync_bool_compare_and_swap (&v, 0, 30000))
15
    abort();
16
  if (30000 != __sync_val_compare_and_swap (&v, 30000, 100001))
17
    abort();
18
  __sync_sub_and_fetch (&v, 0x8001);
19
  __sync_sub_and_fetch (&v, 0x7fff);
20
  if (v != 34465)
21
    abort();
22
  if (__sync_nand_and_fetch (&v, 0xff) != -162)
23
    abort();
24
  if (__sync_fetch_and_add (&v, 262) != -162)
25
    abort();
26
  if (v != 100)
27
    abort();
28
  if (__sync_or_and_fetch (&v, 0xf001) != 0xf065)
29
    abort();
30
  if (__sync_and_and_fetch (&v, 0x1000) != 0x1000)
31
    abort();
32
  if (__sync_xor_and_fetch (&v, 0xa51040) != 0xa50040)
33
    abort();
34
  __sync_and_and_fetch (&v, 7);
35
  if (__sync_lock_test_and_set(&v, 1) != 0)
36
    abort();
37
  if (v != 1)
38
    abort();
39
  __sync_lock_release (&v);
40
  if (v != 0)
41
    abort();
42
#endif
43
  exit(0);
44
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.