(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
pr65494.c
       1  /* { dg-do compile } */
       2  /* { dg-additional-options "-Ofast -funroll-loops" } */
       3  
       4  typedef unsigned char uchar;
       5  typedef struct rgb_ {uchar r; uchar g; uchar b;} rgb;
       6  #define N 512
       7  rgb in[N], out[N];
       8  float c[N];
       9  void foo(int n)
      10  {
      11    int i, j;
      12    for (i = 0; i < n; i++) //in and out are RGB byte arrays
      13      {
      14        float r = 0, g = 0, b = 0;
      15        for (j = 0; j < 5; j++)
      16  	{
      17  	  r += (float)in[i + j].r * c[j];
      18  	  g += (float)in[i + j].g * c[j];
      19  	  b += (float)in[i + j].b * c[j];
      20  	}
      21        out[i].r = (uchar)r;
      22        out[i].g = (uchar)g;
      23        out[i].b = (uchar)b;
      24      }
      25  }
      26  
      27  /* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { target { vect_float && vect_intfloat_cvt } } } } */