1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
3 
4 #define TYPE int
5 #define SIZE 257
6 
7 void __attribute__ ((weak))
f(TYPE * x,TYPE * y,unsigned short n,unsigned short m)8 f (TYPE *x, TYPE *y, unsigned short n, unsigned short m)
9 {
10   for (int i = 0; i < SIZE; ++i)
11     x[i * n] += y[i * m];
12 }
13 
14 /* { dg-final { scan-assembler {\tld1w\tz[0-9]+} } } */
15 /* { dg-final { scan-assembler {\tst1w\tz[0-9]+} } } */
16 /* { dg-final { scan-assembler {\tldr\tw[0-9]+} } } */
17 /* { dg-final { scan-assembler {\tstr\tw[0-9]+} } } */
18 /* Should multiply by (257-1)*4 rather than (VF-1)*4 or (VF-2)*4.  */
19 /* { dg-final { scan-assembler-times {\tubfiz\tx[0-9]+, x2, 10, 16\n} 1 } } */
20 /* { dg-final { scan-assembler-times {\tubfiz\tx[0-9]+, x3, 10, 16\n} 1 } } */
21 /* { dg-final { scan-assembler-not {\tcmp\tx[0-9]+, 0} } } */
22 /* { dg-final { scan-assembler-not {\tcmp\tw[0-9]+, 0} } } */
23 /* { dg-final { scan-assembler-not {\tcsel\tx[0-9]+} } } */
24 /* Two range checks and a check for n being zero.  (m being zero is OK.)  */
25 /* { dg-final { scan-assembler-times {\tcmp\t} 1 } } */
26 /* { dg-final { scan-assembler-times {\tccmp\t} 2 } } */
27