(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
pr60656.c
       1  /* { dg-require-effective-target vect_int } */
       2  /* { dg-require-effective-target vect_long } */
       3  
       4  #include "tree-vect.h"
       5  
       6  __attribute__ ((noinline)) long
       7  foo ()
       8  {
       9    int v[] = {5000, 5001, 5002, 5003};
      10    long s = 0;
      11    int i;
      12  
      13    for(i = 0; i < 4; ++i)
      14      {
      15        long P = v[i];
      16        s += P * P * P;
      17      }
      18    return s;
      19  }
      20  
      21  long
      22  bar ()
      23  {
      24    int v[] = {5000, 5001, 5002, 5003};
      25    long s = 0;
      26    int i;
      27  
      28    for(i = 0; i < 4; ++i)
      29      {
      30        long P = v[i];
      31        s += P * P * P;
      32        __asm__ volatile ("");
      33      }
      34    return s;
      35  }
      36  
      37  int main()
      38  {
      39    check_vect ();
      40  
      41    if (foo () != bar ())
      42      abort ();
      43    return 0;
      44  }
      45  
      46  /* P * P * P requires a widening multiplication first as well as a longxlong->long after that.  */
      47  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_si_to_di_pattern && vect_long_mult } } } } */