testsuite/libgomp.c/atomic-2.c

Go to the documentation of this file.
00001 /* { dg-do run } */
00002 /* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
00003 
00004 #ifdef __x86_64__
00005 #include "cpuid.h"
00006 #endif
00007 
00008 double d = 1.5;
00009 long double ld = 3;
00010 extern void abort (void);
00011 
00012 void
00013 test (void)
00014 {
00015 #pragma omp atomic
00016   d *= 1.25;
00017 #pragma omp atomic
00018   ld /= 0.75;
00019   if (d != 1.875 || ld != 4.0L)
00020     abort ();
00021 }
00022 
00023 int
00024 main (void)
00025 {
00026 #ifdef __x86_64__
00027   unsigned int eax, ebx, ecx, edx;
00028 
00029   if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
00030     return 0;
00031 
00032   if (!(ecx & bit_CMPXCHG16B))
00033     return 0;
00034 #endif
00035   test ();
00036   return 0;
00037 }

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