1/* { dg-do run } */ 2/* { dg-options "-O2 -std=c99" } */ 3/* { dg-additional-options "-msse2" { target sse2_runtime } } */ 4/* { dg-additional-options "-mavx" { target avx_runtime } } */ 5 6int 7main () 8{ 9 int b, c = 0; 10 b = 7; 11 #pragma omp simd linear(b:2) reduction(+:c) 12 for (int i = 0; i < 64; i++) 13 { 14 c = c + (b != 7 + 2 * i); 15 b = b + 2; 16 } 17 if (c || b != 7 + 64 * 2) 18 __builtin_abort (); 19 b = 7; 20 #pragma omp simd linear(b:3) reduction(+:c) 21 for (int i = 0; i < 64; i += 4) 22 { 23 c = c + (b != 7 + i / 4 * 3); 24 b = b + 3; 25 } 26 if (c || b != 7 + 16 * 3) 27 __builtin_abort (); 28 b = 7; 29 #pragma omp simd collapse (2) linear(b:2) reduction(+:c) 30 for (int i = 0; i < 8; i++) 31 for (int j = 0; j < 8; j++) 32 { 33 c = c + (b != 7 + 2 * j + 2 * 8 * i); 34 b = b + 2; 35 } 36 if (c || b != 7 + 64 * 2) 37 __builtin_abort (); 38 b = 7; 39 #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) 40 for (int i = 0; i < 64; i++) 41 { 42 c = c + (b != 7 + 2 * i); 43 b = b + 2; 44 } 45 if (c || b != 7 + 64 * 2) 46 __builtin_abort (); 47 b = 7; 48 #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) 49 for (int i = 0; i < 64; i += 4) 50 { 51 c = c + (b != 7 + i / 4 * 3); 52 b = b + 3; 53 } 54 if (c || b != 7 + 16 * 3) 55 __builtin_abort (); 56 b = 7; 57 #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) 58 for (int i = 0; i < 8; i++) 59 for (int j = 0; j < 8; j++) 60 { 61 c = c + (b != 7 + 2 * j + 2 * 8 * i); 62 b = b + 2; 63 } 64 if (c || b != 7 + 64 * 2) 65 __builtin_abort (); 66 return 0; 67} 68