0
|
1 /* { 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 }
|