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