testsuite/libgomp.c/atomic-5.c

Go to the documentation of this file.
00001 /* PR middle-end/36106 */
00002 /* { dg-options "-O2" } */
00003 /* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
00004 
00005 #ifdef __x86_64__
00006 # include "cpuid.h"
00007 #endif
00008 
00009 extern void abort (void);
00010 
00011 int __attribute__((noinline))
00012 do_test (void)
00013 {
00014   long double d = .0L;
00015   int i;
00016   #pragma omp parallel for shared (d)
00017     for (i = 0; i < 10; i++)
00018       #pragma omp atomic
00019     d += 1.0L;
00020   if (d != 10.0L)
00021     abort ();
00022   return 0;
00023 }
00024 
00025 int
00026 main (void)
00027 {
00028 #ifdef __x86_64__
00029   unsigned int eax, ebx, ecx, edx;
00030 
00031   if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
00032     return 0;
00033 
00034   if (!(ecx & bit_CMPXCHG16B))
00035     return 0;
00036 #endif
00037 
00038   do_test ();
00039 
00040   return 0;
00041 }

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7