Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O -fshrink-wrap -fstack-clash-protection -g" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 #pragma GCC aarch64 "arm_sve.h"
6
7 /*
8 ** test_1:
9 ** str x24, \[sp, -32\]!
10 ** cntb x13
11 ** mov x11, sp
12 ** ...
13 ** sub sp, sp, x13
14 ** cbz w0, [^\n]*
15 ** str p4, \[sp\]
16 ** ...
17 ** ptrue p0\.b, all
18 ** addvl sp, sp, #1
19 ** ldr x24, \[sp\], 32
20 ** ret
21 */
22 svbool_t
23 test_1 (int n)
24 {
25 asm volatile ("" ::: "x24");
26 if (n)
27 {
28 volatile int x = 1;
29 asm volatile ("" ::: "p4");
30 }
31 return svptrue_b8 ();
32 }
33
34 /*
35 ** test_2:
36 ** str x24, \[sp, -32\]!
37 ** cntb x13
38 ** mov x11, sp
39 ** ...
40 ** sub sp, sp, x13
41 ** cbz w0, [^\n]*
42 ** str p4, \[sp\]
43 ** str p5, \[sp, #1, mul vl\]
44 ** str p6, \[sp, #2, mul vl\]
45 ** ...
46 ** ptrue p0\.b, all
47 ** addvl sp, sp, #1
48 ** ldr x24, \[sp\], 32
49 ** ret
50 */
51 svbool_t
52 test_2 (int n)
53 {
54 asm volatile ("" ::: "x24");
55 if (n)
56 {
57 volatile int x = 1;
58 asm volatile ("" ::: "p4", "p5", "p6");
59 }
60 return svptrue_b8 ();
61 }