comparison libgomp/testsuite/libgomp.c/atomic-2.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 /* { dg-do run } */
2 /* { dg-options "-O2 -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 }