Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgomp / testsuite / libgomp.c / atomic-6.c
1 /* PR middle-end/36106 */
2 /* { dg-options "-O2" } */
3 /* { dg-options "-O2 -mieee" { target alpha*-*-* } } */
4 /* { dg-options "-O2 -march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5
6 #ifdef __i386__
7 # include "cpuid.h"
8 #endif
9
10 extern void abort (void);
11
12 union { unsigned long long l; double d; } u = { .l = 0x7ff0000000072301ULL };
13
14 int __attribute__((noinline))
15 do_test (void)
16 {
17 #pragma omp atomic
18   u.d += 1.0L;
19   return 0;
20 }
21
22 int
23 main (void)
24 {
25 #ifdef __i386__
26   unsigned int eax, ebx, ecx, edx;
27
28   if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
29     return 0;
30
31   if (!(edx & bit_CMPXCHG8B))
32     return 0;
33 #endif
34
35   do_test ();
36
37   return 0;
38 }