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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [atomic-1.c] - Blame information for rev 861

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

Line No. Rev Author Line
1 273 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3
 
4
#ifdef __i386__
5
#include "cpuid.h"
6
#endif
7
 
8
extern void abort (void);
9
double d;
10
struct
11
{
12
  int i;
13
  double e;
14
  int j;
15
} x;
16
 
17
void
18
f1 (void)
19
{
20
  #pragma omp atomic
21
    d += 7.5;
22
  #pragma omp atomic
23
    d *= 2.5;
24
  #pragma omp atomic
25
    d /= 0.25;
26
}
27
 
28
void
29
f2 (void)
30
{
31
  #pragma omp atomic
32
    x.e += 7.5;
33
  #pragma omp atomic
34
    x.e *= 2.5;
35
  #pragma omp atomic
36
    x.e /= 0.25;
37
}
38
 
39
int
40
main (void)
41
{
42
#ifdef __i386__
43
  unsigned int eax, ebx, ecx, edx;
44
 
45
  if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
46
    return 0;
47
 
48
  if (!(edx & bit_CMPXCHG8B))
49
    return 0;
50
#endif
51
 
52
  d = 1.0;
53
  f1 ();
54
  if (d != 85.0)
55
    abort ();
56
 
57
  x.e = 1.0;
58
  f2 ();
59
  if (x.i != 0 || x.e != 85.0 || x.j != 0)
60
    abort ();
61
  return 0;
62
}

powered by: WebSVN 2.1.0

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