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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c/] [atomic-12.c] - Blame information for rev 735

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 735 jeremybenn
/* { dg-do run } */
2
 
3
extern void abort (void);
4
_Bool v, x1, x2, x3, x4, x5, x6;
5
 
6
void
7
foo (void)
8
{
9
  #pragma omp atomic capture
10
  v = ++x1;
11
  if (!v)
12
    abort ();
13
  #pragma omp atomic capture
14
  v = x2++;
15
  if (v)
16
    abort ();
17
  #pragma omp atomic capture
18
  v = --x3;
19
  if (v)
20
    abort ();
21
  #pragma omp atomic capture
22
  v = x4--;
23
  if (!v)
24
    abort ();
25
  #pragma omp atomic capture
26
  { v = x5; x5 |= 1; }
27
  if (v)
28
    abort ();
29
  #pragma omp atomic capture
30
  { x6 |= 1; v = x6; }
31
  if (!v)
32
    abort ();
33
}
34
 
35
void
36
bar (void)
37
{
38
  #pragma omp atomic write
39
  x1 = 0;
40
  #pragma omp atomic write
41
  x2 = 0;
42
  #pragma omp atomic write
43
  x3 = 1;
44
  #pragma omp atomic write
45
  x4 = 1;
46
  #pragma omp atomic capture
47
  { ++x1; v = x1; }
48
  if (!v)
49
    abort ();
50
  #pragma omp atomic capture
51
  { v = x2; x2++; }
52
  if (v)
53
    abort ();
54
  #pragma omp atomic capture
55
  { --x3; v = x3; }
56
  if (v)
57
    abort ();
58
  #pragma omp atomic capture
59
  { v = x4; x4--; }
60
  if (!v)
61
    abort ();
62
  #pragma omp atomic write
63
  x1 = 0;
64
  #pragma omp atomic write
65
  x2 = 0;
66
  #pragma omp atomic write
67
  x3 = 1;
68
  #pragma omp atomic write
69
  x4 = 1;
70
  #pragma omp atomic capture
71
  { x1++; v = x1; }
72
  if (!v)
73
    abort ();
74
  #pragma omp atomic capture
75
  { v = x2; ++x2; }
76
  if (v)
77
    abort ();
78
  #pragma omp atomic capture
79
  { x3--; v = x3; }
80
  if (v)
81
    abort ();
82
  #pragma omp atomic capture
83
  { v = x4; --x4; }
84
  if (!v)
85
    abort ();
86
}
87
 
88
int
89
main ()
90
{
91
  #pragma omp atomic write
92
  x3 = 1;
93
  #pragma omp atomic write
94
  x4 = 1;
95
  foo ();
96
  bar ();
97
  return 0;
98
}

powered by: WebSVN 2.1.0

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