Debian Codegraph @

libgomp/testsuite/libgomp.c/atomic-2.c

raw
1 /* { dg-do run } */
2 /* { dg-additional-options "-mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
3
4 #ifdef __x86_64__
5 #include "cpuid.h"
6 #endif
7
8 double d = 1.5;
9 long double ld = 3;
10 extern void abort (void);
11
12 void
13 test (void)
14 {
15 #pragma omp atomic
16 d *= 1.25;
17 #pragma omp atomic
18 ld /= 0.75;
19 if (d != 1.875 || ld != 4.0L)
20 abort ();
21 }
22
23 int
24 main (void)
25 {
26 #ifdef __x86_64__
27 unsigned int eax, ebx, ecx, edx;
28
29 if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
30 return 0;
31
32 if (!(ecx & bit_CMPXCHG16B))
33 return 0;
34 #endif
35 test ();
36 return 0;
37 }