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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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