| 1 |
/* { dg-do compile } */ |
| 2 |
/* Profitable from Power8 since it supports efficient unaligned load. */ |
| 3 |
/* { dg-options "-Ofast -mdejagnu-cpu=power8 -fdump-tree-vect-details -fdump-tree-forwprop4" } */ |
| 4 |
|
| 5 |
#ifndef INDEXTYPE |
| 6 |
#define INDEXTYPE unsigned int |
| 7 |
#endif |
| 8 |
double vmul(INDEXTYPE *rowstart, INDEXTYPE *rowend, |
| 9 |
double *luval, double *dst) |
| 10 |
{ |
| 11 |
double res = 0; |
| 12 |
for (const INDEXTYPE * col = rowstart; col != rowend; ++col, ++luval) |
| 13 |
res += *luval * dst[*col]; |
| 14 |
return res; |
| 15 |
} |
| 16 |
|
| 17 |
/* With gather emulation this should be profitable to vectorize from Power8. */ |
| 18 |
/* { dg-final { scan-tree-dump "loop vectorized" "vect" } } */ |
| 19 |
/* The index vector loads and promotions should be scalar after forwprop. */ |
| 20 |
/* { dg-final { scan-tree-dump-not "vec_unpack" "forwprop4" } } */ |