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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [atomic-load-1.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 1 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 char.  */
8
 
9
extern void abort(void);
10
 
11
char v, count;
12
 
13
main ()
14
{
15
  v = 0;
16
  count = 0;
17
 
18
  if (__atomic_load_n (&v, __ATOMIC_RELAXED) != count++)
19
    abort();
20
  else
21
    v++;
22
 
23
  if (__atomic_load_n (&v, __ATOMIC_ACQUIRE) != count++)
24
    abort();
25
  else
26
    v++;
27
 
28
  if (__atomic_load_n (&v, __ATOMIC_CONSUME) != count++)
29
    abort();
30
  else
31
    v++;
32
 
33
  if (__atomic_load_n (&v, __ATOMIC_SEQ_CST) != count++)
34
    abort();
35
  else
36
    v++;
37
 
38
  /* Now test the generic variants.  */
39
 
40
  __atomic_load (&v, &count, __ATOMIC_RELAXED);
41
  if (count != v)
42
    abort();
43
  else
44
    v++;
45
 
46
  __atomic_load (&v, &count, __ATOMIC_ACQUIRE);
47
  if (count != v)
48
    abort();
49
  else
50
    v++;
51
 
52
  __atomic_load (&v, &count, __ATOMIC_CONSUME);
53
  if (count != v)
54
    abort();
55
  else
56
    v++;
57
 
58
  __atomic_load (&v, &count, __ATOMIC_SEQ_CST);
59
  if (count != v)
60
    abort();
61
  else
62
    v++;
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.