Debian Codegraph @

libgomp/testsuite/libgomp.c/atomic-5.c

raw
1 /* PR middle-end/36106 */
2 /* { dg-additional-options "-mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
3
4 #ifdef __x86_64__
5 # include "cpuid.h"
6 #endif
7
8 extern void abort (void);
9
10 int __attribute__((noinline))
11 do_test (void)
12 {
13 long double d = .0L;
14 int i;
15 #pragma omp parallel for shared (d)
16 for (i = 0; i < 10; i++)
17 #pragma omp atomic
18 d += 1.0L;
19 if (d != 10.0L)
20 abort ();
21 return 0;
22 }
23
24 int
25 main (void)
26 {
27 #ifdef __x86_64__
28 unsigned int eax, ebx, ecx, edx;
29
30 if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
31 return 0;
32
33 if (!(ecx & bit_CMPXCHG16B))
34 return 0;
35 #endif
36
37 do_test ();
38
39 return 0;
40 }