gcc/testsuite/gcc.target/aarch64/pr94398.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -ftree-loop-vectorize -funsafe-math-optimizations -march=armv8.2-a+sve -mstrict-align" } */ |
| 3 | |
| 4 | float |
| 5 | foo(long n, float *x, int inc_x, |
| 6 | float *y, int inc_y) |
| 7 | { |
| 8 | float dot = 0.0; |
| 9 | int ix = 0, iy = 0; |
| 10 | |
| 11 | if (n < 0) { |
| 12 | return dot; |
| 13 | } |
| 14 | |
| 15 | int i = 0; |
| 16 | while (i < n) { |
| 17 | dot += y[iy] * x[ix]; |
| 18 | ix += inc_x; |
| 19 | iy += inc_y; |
| 20 | i++; |
| 21 | } |
| 22 | |
| 23 | return dot; |
| 24 | } |