simd-2.c 685 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* { dg-do run } */
  2. /* { dg-options "-O2" } */
  3. /* { dg-additional-options "-msse2" { target sse2_runtime } } */
  4. /* { dg-additional-options "-mavx" { target avx_runtime } } */
  5. extern void abort ();
  6. __UINTPTR_TYPE__ arr[1027];
  7. __attribute__((noinline, noclone)) void
  8. foo ()
  9. {
  10. int i, v;
  11. #pragma omp simd private (v) safelen(16)
  12. for (i = 0; i < 1027; i++)
  13. arr[i] = (__UINTPTR_TYPE__) &v;
  14. }
  15. int
  16. main ()
  17. {
  18. int i, j, cnt = 0;
  19. __UINTPTR_TYPE__ arr2[16];
  20. foo ();
  21. for (i = 0; i < 1027; i++)
  22. {
  23. for (j = 0; j < cnt; j++)
  24. if (arr[i] == arr2[j])
  25. break;
  26. if (j != cnt)
  27. continue;
  28. if (cnt == 16)
  29. abort ();
  30. arr2[cnt++] = arr[i];
  31. }
  32. return 0;
  33. }