157 lines
2.6 KiB
C
157 lines
2.6 KiB
C
|
/* { dg-do run } */
|
||
|
|
||
|
extern void abort (void);
|
||
|
int x = 6;
|
||
|
float y;
|
||
|
|
||
|
int
|
||
|
main (void)
|
||
|
{
|
||
|
int v;
|
||
|
float f;
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 6)
|
||
|
abort ();
|
||
|
#pragma omp atomic write
|
||
|
x = 17;
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 17)
|
||
|
abort ();
|
||
|
#pragma omp atomic update
|
||
|
x++;
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 18)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
v = x++;
|
||
|
if (v != 18)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 19)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
v = ++x;
|
||
|
if (v != 20)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 20)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ v = x; x *= 3; }
|
||
|
if (v != 20)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 60)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{
|
||
|
x |= 2;
|
||
|
v = x;
|
||
|
}
|
||
|
if (v != 62)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 62)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ v = x; x++; }
|
||
|
if (v != 62)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ v = x; ++x; }
|
||
|
if (v != 63)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{
|
||
|
++x;
|
||
|
v = x;
|
||
|
}
|
||
|
if (v != 65)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{x++;v=x;}if (v != 66)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 66)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ v = x; x--; }
|
||
|
if (v != 66)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ v = x; --x; }
|
||
|
if (v != 65)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{
|
||
|
--x;
|
||
|
v = x;
|
||
|
}
|
||
|
if (v != 63)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ x--; v = x; } if (v != 62)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
v = x;
|
||
|
if (v != 62)
|
||
|
abort ();
|
||
|
#pragma omp atomic write
|
||
|
y = 17.5f;
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (f != 17.5)
|
||
|
abort ();
|
||
|
#pragma omp atomic update
|
||
|
y *= 2.0f;
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (y != 35.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
f = y *= 2.0f;
|
||
|
if (f != 70.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
f = y++;
|
||
|
if (f != 70.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (f != 71.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
f = --y;
|
||
|
if (f != 70.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (f != 70.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ f = y; y /= 2.0f; }
|
||
|
if (f != 70.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (f != 35.0)
|
||
|
abort ();
|
||
|
#pragma omp atomic capture
|
||
|
{ y /= 2.0f; f = y; }
|
||
|
if (f != 17.5)
|
||
|
abort ();
|
||
|
#pragma omp atomic read
|
||
|
f = y;
|
||
|
if (f != 17.5)
|
||
|
abort ();
|
||
|
return 0;
|
||
|
}
|