1 /* { dg-require-effective-target vect_int } */ 2 3 #include <stdarg.h> 4 #include "tree-vect.h" 5 6 #define N 256 7 8 __attribute__ ((noinline)) main1(signed char x,signed char max_result,signed char min_result)9void main1 (signed char x, signed char max_result, signed char min_result) 10 { 11 int i; 12 signed char b[N]; 13 signed char c[N]; 14 signed char check_diff = 2; 15 signed char diff = 2; 16 signed char max = x; 17 signed char min = x; 18 19 check_diff = 2; 20 for (i = 0; i < N; i++) { 21 b[i] = i; 22 c[i] = i; 23 if (i%16 == 0) 24 { 25 c[i] = i + 1; 26 check_diff += 1; 27 } 28 if (c[i] > max_result) 29 max_result = c[i]; 30 if (c[i] < min_result) 31 min_result = c[i]; 32 asm volatile ("" ::: "memory"); 33 } 34 35 for (i = 0; i < N; i++) { 36 diff += (signed char) (c[i] - b[i]); 37 } 38 39 for (i = 0; i < N; i++) { 40 max = max < c[i] ? c[i] : max; 41 } 42 43 for (i = 0; i < N; i++) { 44 min = min > c[i] ? c[i] : min; 45 } 46 47 /* check results: */ 48 if (diff != check_diff) 49 abort (); 50 if (max != max_result) 51 abort (); 52 if (min != min_result) 53 abort (); 54 } 55 main(void)56int main (void) 57 { 58 check_vect (); 59 60 main1 (100, 100, 1); 61 main1 (0, 15, 0); 62 return 0; 63 } 64 65 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */ 66