aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c
blob: bf98045ab03cf59439e718c125575ebfe0f4003a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* Profitable from Power8 since it supports efficient unaligned load.  */
/* { dg-options "-Ofast -mdejagnu-cpu=power8 -fdump-tree-vect-details -fdump-tree-forwprop4" } */

#ifndef INDEXTYPE
#define INDEXTYPE unsigned int
#endif
double vmul(INDEXTYPE *rowstart, INDEXTYPE *rowend,
	    double *luval, double *dst)
{
  double res = 0;
  for (const INDEXTYPE * col = rowstart; col != rowend; ++col, ++luval)
        res += *luval * dst[*col];
  return res;
}

/* With gather emulation this should be profitable to vectorize from Power8.  */
/* { dg-final { scan-tree-dump "loop vectorized" "vect" } } */
/* The index vector loads and promotions should be scalar after forwprop.  */
/* { dg-final { scan-tree-dump-not "vec_unpack" "forwprop4" } } */