Handle peeling for alignment with masking
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / struct_vect_1.c
blob014f4ecc494a93e53c904f0d06a0ed6baf0801fe
1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -ftree-vectorize --save-temps" } */
4 #ifndef TYPE
5 #define TYPE unsigned char
6 #endif
8 #ifndef NAME
9 #define NAME(X) X
10 #endif
12 #define N 1024
14 void __attribute__ ((noinline, noclone))
15 NAME(f2) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c)
17 for (int i = 0; i < N; ++i)
19 a[i] = c[i * 2];
20 b[i] = c[i * 2 + 1];
24 void __attribute__ ((noinline, noclone))
25 NAME(f3) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
26 TYPE *__restrict d)
28 for (int i = 0; i < N; ++i)
30 a[i] = d[i * 3];
31 b[i] = d[i * 3 + 1];
32 c[i] = d[i * 3 + 2];
36 void __attribute__ ((noinline, noclone))
37 NAME(f4) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
38 TYPE *__restrict d, TYPE *__restrict e)
40 for (int i = 0; i < N; ++i)
42 a[i] = e[i * 4];
43 b[i] = e[i * 4 + 1];
44 c[i] = e[i * 4 + 2];
45 d[i] = e[i * 4 + 3];
49 void __attribute__ ((noinline, noclone))
50 NAME(g2) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c)
52 for (int i = 0; i < N; ++i)
54 c[i * 2] = a[i];
55 c[i * 2 + 1] = b[i];
59 void __attribute__ ((noinline, noclone))
60 NAME(g3) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
61 TYPE *__restrict d)
63 for (int i = 0; i < N; ++i)
65 d[i * 3] = a[i];
66 d[i * 3 + 1] = b[i];
67 d[i * 3 + 2] = c[i];
71 void __attribute__ ((noinline, noclone))
72 NAME(g4) (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
73 TYPE *__restrict d, TYPE *__restrict e)
75 for (int i = 0; i < N; ++i)
77 e[i * 4] = a[i];
78 e[i * 4 + 1] = b[i];
79 e[i * 4 + 2] = c[i];
80 e[i * 4 + 3] = d[i];
84 /* { dg-final { scan-assembler {\tld2b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7]/z, \[x[0-9]+\]\n} } } */
85 /* { dg-final { scan-assembler {\tld3b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7]/z, \[x[0-9]+\]\n} } } */
86 /* { dg-final { scan-assembler {\tld4b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7]/z, \[x[0-9]+\]\n} } } */
87 /* { dg-final { scan-assembler {\tst2b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7], \[x[0-9]+\]\n} } } */
88 /* { dg-final { scan-assembler {\tst3b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7], \[x[0-9]+\]\n} } } */
89 /* { dg-final { scan-assembler {\tst4b\t{z[0-9]+.b - z[0-9]+.b}, p[0-7], \[x[0-9]+\]\n} } } */