OSDN Git Service

PR middle-end/25261
[pf3gnuchains/gcc-fork.git] / libgomp / testsuite / libgomp.c / atomic-2.c
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fopenmp" } */
3 /* { dg-options "-O2 -fopenmp -march=nocona" { target i?86-*-* x86_64-*-* } } */
4 /* { dg-options "-O2 -fopenmp" { target ilp32 } } */
5
6 double d = 1.5;
7 long double ld = 3;
8 extern void abort (void);
9
10 void
11 test (void)
12 {
13 #pragma omp atomic
14   d *= 1.25;
15 #pragma omp atomic
16   ld /= 0.75;
17   if (d != 1.875 || ld != 4.0L)
18     abort ();
19 }
20
21 int
22 main (void)
23 {
24 #ifdef __x86_64__
25 # define bit_SSE3 (1 << 0)
26 # define bit_CX16 (1 << 13)
27   unsigned int ax, bx, cx, dx;
28   __asm__ ("cpuid" : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx)
29            : "0" (1) : "cc");
30   if ((cx & (bit_SSE3 | bit_CX16)) != (bit_SSE3 | bit_CX16))
31     return 0;
32 #endif
33   test ();
34   return 0;
35 }