atomic-6.c 643 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* PR middle-end/36106 */
  2. /* { dg-additional-options "-mieee" { target alpha*-*-* } } */
  3. /* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
  4. #ifdef __i386__
  5. # include "cpuid.h"
  6. #endif
  7. extern void abort (void);
  8. union { unsigned long long l; double d; } u = { .l = 0x7ff0000000072301ULL };
  9. int __attribute__((noinline))
  10. do_test (void)
  11. {
  12. #pragma omp atomic
  13. u.d += 1.0L;
  14. return 0;
  15. }
  16. int
  17. main (void)
  18. {
  19. #ifdef __i386__
  20. unsigned int eax, ebx, ecx, edx;
  21. if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
  22. return 0;
  23. if (!(edx & bit_CMPXCHG8B))
  24. return 0;
  25. #endif
  26. do_test ();
  27. return 0;
  28. }