(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-reduc-pattern-3.c
       1  /* { dg-require-effective-target vect_int_mult } */
       2  
       3  #include <stdarg.h>
       4  #include "tree-vect.h"
       5  
       6  #define N 10
       7  #define RES 1024
       8  
       9  /* A reduction pattern in which there is no data ref in
      10     the loop and one operand is defined outside of the loop.  */
      11  
      12  __attribute__ ((noinline)) int
      13  foo (int v)
      14  {
      15    int i;
      16    int result = 1;
      17  
      18    ++v;
      19    for (i = 0; i < N; i++)
      20      result *= v;
      21  
      22    return result;
      23  }
      24  
      25  int
      26  main (void)
      27  {
      28    int res;
      29  
      30    check_vect ();
      31  
      32    res = foo (1);
      33    if (res != RES)
      34      abort ();
      35  
      36    return 0;
      37  }
      38  
      39  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
      40