Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/struct_vect_24.c

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target supports_stack_clash_protection } */
3 /* { dg-options "-O3 -fopenmp-simd -fstack-clash-protection --param stack-clash-protection-guard-size=16 -fno-stack-protector" } */
4
5 #include <stdint.h>
6
7 #define N 50
8 #define S 2 * 64 * 1024
9
10 /* Invoke X (P##n) for n in [0, 9]. */
11 #define REPEAT8(X, P) \
12 X (P##0) X (P##1) X (P##2) X (P##3) X (P##4) X (P##5) X (P##6) X (P##7) \
13 X (P##8) X (P##9)
14
15 /* Invoke X (n) for all n in [0, 49]. */
16 #define REPEAT50(X) \
17 REPEAT8 (X, ) REPEAT8 (X, 1) REPEAT8 (X, 2) REPEAT8 (X, 3) REPEAT8 (X, 4)
18
19 /* Try to force some spilling. */
20 #define DECLARE(N) int src##N = src[N * 4];
21 #define INC(N) dest[i] += src##N;
22
23 #define TEST_LOOP(NAME, TYPE) \
24 void __attribute__ ((noinline, noclone, simd)) \
25 NAME (TYPE *restrict dest, TYPE *restrict src) \
26 { \
27 REPEAT50 (DECLARE); \
28 volatile char foo[S]; \
29 foo[S-1]=1; \
30 for (int i = 0; i < N; i++) \
31 { \
32 REPEAT50 (INC); \
33 } \
34 }
35
36 #define TEST(NAME) \
37 TEST_LOOP (NAME##_i32, int32_t) \
38 TEST_LOOP (NAME##_i64, int64_t) \
39 TEST_LOOP (NAME##_f32, float) \
40 TEST_LOOP (NAME##_f64, double)
41
42 TEST (test)
43
44 /* Check the vectorized loop for stack clash probing. */
45
46 /* { dg-final { scan-assembler-times {str\s+xzr, \[sp, 0\]} 4 } } */
47 /* { dg-final { scan-assembler-times {cmp\s+x[0-9]+, 61440} 4 } } */
48 /* { dg-final { scan-assembler-times {sub\s+x[0-9]+, x[0-9]+, 61440} 4 } } */