Allow single-element interleaving for non-power-of-2 strides
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / struct_vect_19_run.c
blob1d0325f75138c3d4e370ced11ce9af9df226b325
1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
4 #include "struct_vect_19.c"
6 #define N 1000
8 #undef TEST_LOOP
9 #define TEST_LOOP(NAME, TYPE) \
10 { \
11 TYPE out[N]; \
12 TYPE in[N * 3]; \
13 int counts[] = { 0, 1, N - 1 }; \
14 for (int j = 0; j < 3; ++j) \
15 { \
16 int count = counts[j]; \
17 for (int i = 0; i < N; ++i) \
18 { \
19 out[i] = i * 7 / 2; \
20 asm volatile ("" ::: "memory"); \
21 } \
22 for (int i = 0; i < N * 3; ++i) \
23 { \
24 in[i] = i * 9 / 2; \
25 asm volatile ("" ::: "memory"); \
26 } \
27 NAME (out, in, count); \
28 for (int i = 0; i < N; ++i) \
29 { \
30 TYPE expected = i * 7 / 2; \
31 if (i < count) \
32 expected += in[i * 3]; \
33 if (out[i] != expected) \
34 __builtin_abort (); \
35 asm volatile ("" ::: "memory"); \
36 } \
37 } \
40 int __attribute__ ((optimize (1)))
41 main (void)
43 TEST (test);
44 return 0;