Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.c/atomic-5.c @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 /* PR middle-end/36106 */ | |
2 /* { dg-options "-O2" } */ | |
3 /* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ | |
4 | |
5 #ifdef __x86_64__ | |
6 # include "cpuid.h" | |
7 #endif | |
8 | |
9 extern void abort (void); | |
10 | |
11 int __attribute__((noinline)) | |
12 do_test (void) | |
13 { | |
14 long double d = .0L; | |
15 int i; | |
16 #pragma omp parallel for shared (d) | |
17 for (i = 0; i < 10; i++) | |
18 #pragma omp atomic | |
19 d += 1.0L; | |
20 if (d != 10.0L) | |
21 abort (); | |
22 return 0; | |
23 } | |
24 | |
25 int | |
26 main (void) | |
27 { | |
28 #ifdef __x86_64__ | |
29 unsigned int eax, ebx, ecx, edx; | |
30 | |
31 if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) | |
32 return 0; | |
33 | |
34 if (!(ecx & bit_CMPXCHG16B)) | |
35 return 0; | |
36 #endif | |
37 | |
38 do_test (); | |
39 | |
40 return 0; | |
41 } |