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-1.c] - Blame information for rev 856

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
/* { dg-options "-O2 -fopenmp -march=pentium" { target i?86-*-* x86_64-*-* } } */
4
/* { dg-options "-O2 -fopenmp" { target lp64 } } */
5
 
6
#ifdef __i386__
7
#include "../../../gcc/testsuite/gcc.dg/i386-cpuid.h"
8
#define bit_CX8 (1 << 8)
9
#endif
10
 
11
extern void abort (void);
12
double d;
13
struct
14
{
15
  int i;
16
  double e;
17
  int j;
18
} x;
19
 
20
void
21
f1 (void)
22
{
23
  #pragma omp atomic
24
    d += 7.5;
25
  #pragma omp atomic
26
    d *= 2.5;
27
  #pragma omp atomic
28
    d /= 0.25;
29
}
30
 
31
void
32
f2 (void)
33
{
34
  #pragma omp atomic
35
    x.e += 7.5;
36
  #pragma omp atomic
37
    x.e *= 2.5;
38
  #pragma omp atomic
39
    x.e /= 0.25;
40
}
41
 
42
int
43
main (void)
44
{
45
#ifdef __i386__
46
  unsigned long cpu_facilities;
47
 
48
  cpu_facilities = i386_cpuid ();
49
 
50
  if ((cpu_facilities & bit_CX8) == 0)
51
    return 0;
52
#endif
53
 
54
  d = 1.0;
55
  f1 ();
56
  if (d != 85.0)
57
    abort ();
58
 
59
  x.e = 1.0;
60
  f2 ();
61
  if (x.i != 0 || x.e != 85.0 || x.j != 0)
62
    abort ();
63
  return 0;
64
}

powered by: WebSVN 2.1.0

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