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

Subversion Repositories openrisc

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

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 2 byte
2
   values with each valid memory model.  */
3
/* { dg-do run } */
4
/* { dg-require-effective-target sync_char_short } */
5
 
6
 
7
/* Test the execution of the __atomic_load_n builtin for a short.  */
8
 
9
extern void abort(void);
10
 
11
short v, count;
12
 
13
 
14
main ()
15
{
16
  v = 0;
17
  count = 0;
18
 
19
  if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
20
    abort();
21
  else
22
    v++;
23
 
24
  if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
25
    abort();
26
  else
27
    v++;
28
 
29
  if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
30
    abort();
31
  else
32
    v++;
33
 
34
  if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
35
    abort();
36
  else
37
    v++;
38
 
39
  /* Now test the generic variants.  */
40
 
41
  __atomic_load (&v, &count, __ATOMIC_RELAXED);
42
  if (count != v)
43
    abort();
44
  else
45
    v++;
46
 
47
  __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
48
  if (count != v)
49
    abort();
50
  else
51
    v++;
52
 
53
  __atomic_load (&v, &count, __ATOMIC_CONSUME);
54
  if (count != v)
55
    abort();
56
  else
57
    v++;
58
 
59
  __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
60
  if (count != v)
61
    abort();
62
  else
63
    v++;
64
 
65
 
66
  return 0;
67
}
68
 

powered by: WebSVN 2.1.0

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