(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-reduc-2short.c
       1  /* { dg-require-effective-target vect_int } */
       2  
       3  #include <stdarg.h>
       4  #include "tree-vect.h"
       5  
       6  #define N 16
       7  #define DIFF 242
       8  
       9  __attribute__ ((noinline))
      10  void main1 (short x, short max_result, short min_result)
      11  {
      12    int i;
      13    short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
      14    short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
      15    short diff = 2;
      16    short max = x;
      17    short min = x;
      18  
      19    for (i = 0; i < N; i++) {
      20      diff += (short)(b[i] - c[i]);
      21    }
      22    for (i = 0; i < N; i++) {
      23      max = max < c[i] ? c[i] : max;
      24    }
      25  
      26    for (i = 0; i < N; i++) {
      27      min = min > c[i] ? c[i] : min;
      28    }
      29  
      30    /* check results:  */
      31    if (diff != DIFF)
      32      abort ();
      33    if (max != max_result)
      34      abort ();
      35    if (min != min_result)
      36      abort ();
      37  }
      38  
      39  int main (void)
      40  { 
      41    check_vect ();
      42    
      43    main1 (100, 100, 1);
      44    main1 (0, 15, 0);
      45    return 0;
      46  }
      47  
      48  /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_no_int_min_max } } } } */