1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -mavx2 -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-vect-details -mprefer-vector-width=256" } */
       3  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
       4  
       5  #define N 10000
       6  
       7  void
       8  __attribute__((noipa))
       9  foo_mul (int* a, int b)
      10  {
      11    for (int i = 0; i != N; i++)
      12      {
      13        a[i] = b;
      14        b *= 3;
      15      }
      16  }
      17  
      18  void
      19  __attribute__((noipa))
      20  foo_mul_const (int* a)
      21  {
      22    int b = 1;
      23    for (int i = 0; i != N; i++)
      24      {
      25        a[i] = b;
      26        b *= 3;
      27      }
      28  }
      29  
      30  void
      31  __attribute__((noipa))
      32  foo_mul_peel (int* a, int b)
      33  {
      34    for (int i = 0; i != 39; i++)
      35      {
      36        a[i] = b;
      37        b *= 3;
      38      }
      39  }
      40  
      41  void
      42  __attribute__((noipa))
      43  foo_mul_peel_const (int* a)
      44  {
      45    int b = 1;
      46    for (int i = 0; i != 39; i++)
      47      {
      48        a[i] = b;
      49        b *= 3;
      50      }
      51  }