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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [atomic-load-4.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test __atomic routines for existence and proper execution on 8 byte
2
   values with each valid memory model.  */
3
/* { dg-do run } */
4
/* { dg-require-effective-target sync_long_long_runtime } */
5
/* { dg-options "" } */
6
/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
7
 
8
extern void abort(void);
9
 
10
long long v, count;
11
 
12
main ()
13
{
14
  v = 0;
15
  count = 0;
16
 
17
  if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
18
    abort();
19
  else
20
    v++;
21
 
22
  if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
23
    abort();
24
  else
25
    v++;
26
 
27
  if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
28
    abort();
29
  else
30
    v++;
31
 
32
  if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
33
    abort();
34
  else
35
    v++;
36
 
37
  /* Now test the generic variants.  */
38
 
39
  __atomic_load (&v, &count, __ATOMIC_RELAXED);
40
  if (count != v)
41
    abort();
42
  else
43
    v++;
44
 
45
  __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
46
  if (count != v)
47
    abort();
48
  else
49
    v++;
50
 
51
  __atomic_load (&v, &count, __ATOMIC_CONSUME);
52
  if (count != v)
53
    abort();
54
  else
55
    v++;
56
 
57
  __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
58
  if (count != v)
59
    abort();
60
  else
61
    v++;
62
 
63
 
64
  return 0;
65
}
66
 

powered by: WebSVN 2.1.0

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