simd-10.c 451 B

123456789101112131415161718192021222324252627
  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. int s = 0, i, u;
  6. void
  7. foo ()
  8. {
  9. #pragma omp for simd schedule(static, 32) reduction(+:s) lastprivate(u)
  10. for (i = 0; i < 128; i++)
  11. {
  12. s++;
  13. u = i;
  14. }
  15. if (i != 128 || s != 128 || u != 127)
  16. __builtin_abort ();
  17. }
  18. int
  19. main ()
  20. {
  21. foo ();
  22. return 0;
  23. }