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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgomp/] [testsuite/] [libgomp.c++/] [atomic-2.C] - Rev 810

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

// { dg-do run }

extern "C" 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;
}

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

powered by: WebSVN 2.1.0

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