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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libgomp/] [testsuite/] [libgomp.c/] [atomic-10.c] - Blame information for rev 855

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

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

powered by: WebSVN 2.1.0

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