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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c/] [atomic-10.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
int x1, x2, x3, x4, x5;
5
volatile int y6 = 9, y2, y3, y4, y5;
6
volatile unsigned char z1, z2, z3, z4, z5;
7
float a1, a2, a3, a4;
8
 
9
void
10
f1 (void)
11
{
12
  #pragma omp atomic
13
    x1++;
14
  #pragma omp atomic
15
    x2--;
16
  #pragma omp atomic
17
    ++x3;
18
  #pragma omp atomic
19
    --x4;
20
  #pragma omp atomic
21
    x5 += 1;
22
  #pragma omp atomic
23
    x1 -= y6;
24
  #pragma omp atomic
25
    x2 |= 1;
26
  #pragma omp atomic
27
    x3 &= 1;
28
  #pragma omp atomic
29
    x4 ^= 1;
30
  #pragma omp atomic
31
    x5 *= 3;
32
  #pragma omp atomic
33
    x1 /= 3;
34
  #pragma omp atomic
35
    x2 /= 3;
36
  #pragma omp atomic
37
    x3 <<= 3;
38
  #pragma omp atomic
39
    x4 >>= 3;
40
}
41
 
42
void
43
f2 (void)
44
{
45
  #pragma omp atomic
46
    y6++;
47
  #pragma omp atomic
48
    y2--;
49
  #pragma omp atomic
50
    ++y3;
51
  #pragma omp atomic
52
    --y4;
53
  #pragma omp atomic
54
    y5 += 1;
55
  #pragma omp atomic
56
    y6 -= x1;
57
  #pragma omp atomic
58
    y2 |= 1;
59
  #pragma omp atomic
60
    y3 &= 1;
61
  #pragma omp atomic
62
    y4 ^= 1;
63
  #pragma omp atomic
64
    y5 *= 3;
65
  #pragma omp atomic
66
    y6 /= 3;
67
  #pragma omp atomic
68
    y2 /= 3;
69
  #pragma omp atomic
70
    y3 <<= 3;
71
  #pragma omp atomic
72
    y4 >>= 3;
73
}
74
 
75
void
76
f3 (void)
77
{
78
  #pragma omp atomic
79
    z1++;
80
  #pragma omp atomic
81
    z2--;
82
  #pragma omp atomic
83
    ++z3;
84
  #pragma omp atomic
85
    --z4;
86
  #pragma omp atomic
87
    z5 += 1;
88
  #pragma omp atomic
89
    z1 |= 1;
90
  #pragma omp atomic
91
    z2 &= 1;
92
  #pragma omp atomic
93
    z3 ^= 1;
94
  #pragma omp atomic
95
    z4 *= 3;
96
  #pragma omp atomic
97
    z5 /= 3;
98
  #pragma omp atomic
99
    z1 /= 3;
100
  #pragma omp atomic
101
    z2 <<= 3;
102
  #pragma omp atomic
103
    z3 >>= 3;
104
}
105
 
106
void
107
f4 (void)
108
{
109
  #pragma omp atomic
110
    a1 += 8.0;
111
  #pragma omp atomic
112
    a2 *= 3.5;
113
  #pragma omp atomic
114
    a3 -= a1 + a2;
115
  #pragma omp atomic
116
    a4 /= 2.0;
117
}
118
 
119
int
120
main (void)
121
{
122
  f1 ();
123
  if (x1 != -2 || x2 != 0 || x3 != 8 || x4 != -1 || x5 != 3)
124
    abort ();
125
  f2 ();
126
  if (y6 != 4 || y2 != 0 || y3 != 8 || y4 != -1 || y5 != 3)
127
    abort ();
128
  f3 ();
129
  if (z1 != 0 || z2 != 8 || z3 != 0 || z4 != 253 || z5 != 0)
130
    abort ();
131
  a1 = 7;
132
  a2 = 10;
133
  a3 = 11;
134
  a4 = 13;
135
  f4 ();
136
  if (a1 != 15.0 || a2 != 35.0 || a3 != -39.0 || a4 != 6.5)
137
    abort ();
138
  return 0;
139
}

powered by: WebSVN 2.1.0

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