1  /* { dg-require-effective-target vect_condition } */
       2  
       3  #include "tree-vect.h"
       4  
       5  extern void abort (void) __attribute__ ((noreturn));
       6  
       7  #define N 30
       8  
       9  /* Condition reduction where loop type is different than the data type.  */
      10  
      11  int
      12  condition_reduction (int *a, int min_v)
      13  {
      14    int last = N + 65;
      15  
      16    for (char i = 0; i < N; i++)
      17      if (a[i] < min_v)
      18        last = a[i];
      19  
      20    return last;
      21  }
      22  
      23  
      24  int
      25  main (void)
      26  {
      27    int a[N] = {
      28    67, 32, 45, 43, 21, -11, 12, 3, 4, 5,
      29    6, 76, -32, 56, -32, -1, 4, 5, 6, 99,
      30    43, 22, -3, 22, 16, 34, 55, 31, 87, 324
      31    };
      32  
      33    check_vect ();
      34  
      35    int ret = condition_reduction (a, 16);
      36  
      37    if (ret != -3)
      38      abort ();
      39  
      40    return 0;
      41  }
      42  
      43  /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
      44  /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 2 "vect" { target vect_fold_extract_last } } } */
      45  /* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */