pr90811.c 638 B

1234567891011121314151617181920212223242526272829
  1. /* PR target/90811 */
  2. int
  3. main ()
  4. {
  5. long long a[100], b[100];
  6. int i;
  7. for (i = 0; i < 100; i++)
  8. {
  9. a[i] = i;
  10. b[i] = i % 10;
  11. }
  12. #pragma omp target teams distribute parallel for simd map(tofrom: a[:100], b[:100])
  13. for (i = 0; i < 100; i++)
  14. {
  15. long long c = 0;
  16. const long long d[] = { 1, 3, 5, 7, 9 };
  17. for (int j = 4; j >= 0; j--)
  18. c = d[j] + b[i] * c;
  19. a[i] += c;
  20. }
  21. for (i = 0; i < 100; i++)
  22. {
  23. const long long r[] = { 1, 26, 229, 976, 2849, 6646, 13381, 24284, 40801, 64594 };
  24. if (a[i] != r[i % 10] + (i / 10 * 10))
  25. __builtin_abort ();
  26. }
  27. return 0;
  28. }