]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
aarch64: Fix the hyphenated disassembly comment.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-aix-prologue.c
CommitLineData
c0586a34
JB
1/* This testcase is part of GDB, the GNU debugger.
2
1d506c26 3 Copyright 2004-2024 Free Software Foundation, Inc.
c0586a34
JB
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
a9762ec7 7 the Free Software Foundation; either version 3 of the License, or
c0586a34
JB
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
a9762ec7 14
c0586a34 15 You should have received a copy of the GNU General Public License
a9762ec7 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c0586a34
JB
17
18void li_stw (void);
19
3b8a7fc0
JG
20void stack_check_probe_1 (void);
21void stack_check_probe_2 (void);
22void stack_check_probe_loop_1 (void);
23void stack_check_probe_loop_2 (void);
24
c0586a34
JB
25int
26main (void)
27{
28 li_stw ();
3b8a7fc0
JG
29 stack_check_probe_1 ();
30 stack_check_probe_2 ();
31 stack_check_probe_loop_1 ();
32 stack_check_probe_loop_2 ();
c0586a34
JB
33 return 0;
34}
35
36/* Asm for procedure li_stw().
37
38 The purpose of this function is to verify that GDB does not
39 include the li insn as part of the function prologue (only part
40 of the prologue if part of a pair of insns saving vector registers).
41 Similarly, GDB should not include the stw insn following the li insn,
42 because the source register is not used for parameter passing. */
43
44
45asm (" .csect .text[PR]\n"
46 " .align 2\n"
47 " .lglobl .li_stw\n"
48 " .csect li_stw[DS]\n"
49 "li_stw:\n"
50 " .long .li_stw, TOC[tc0], 0\n"
51 " .csect .text[PR]\n"
52 ".li_stw:\n"
53 " stw 31,-4(1)\n"
54 " stwu 1,-48(1)\n"
55 " mr 31,1\n"
56 " stw 11,24(31)\n"
57 " li 0,8765\n"
58 " stw 0,28(31)\n"
59 " lwz 1,0(1)\n"
60 " lwz 31,-4(1)\n"
61 " blr\n");
62
3b8a7fc0
JG
63/* Asm for procedure stack_check_probe_1().
64
65 The purpose of this function is to verify that GDB can skip the stack
66 checking probing at the beginning of the prologue. */
67
68asm (" .csect .text[PR]\n"
69 " .align 2\n"
70 " .globl stack_check_probe_1\n"
71 " .globl .stack_check_probe_1\n"
72 " .csect stack_check_probe_1[DS]\n"
73 "stack_check_probe_1:\n"
74 " .long .stack_check_probe_1, TOC[tc0], 0\n"
75 " .csect .text[PR]\n"
76 ".stack_check_probe_1:\n"
77 " stw 0,-12336(1)\n"
78 " stw 31,-4(1)\n"
79 " stwu 1,-48(1)\n"
80 " mr 31,1\n"
81 " lwz 1,0(1)\n"
82 " lwz 31,-4(1)\n"
83 " blr\n");
84
85/* Asm for procedure stack_check_probe_2 ().
86
87 Similar to stack_check_probe_1, but with a different probing sequence
88 (several probes). */
89
90asm (" .csect .text[PR]\n"
91 " .align 2\n"
92 " .globl stack_check_probe_2\n"
93 " .globl .stack_check_probe_2\n"
94 " .csect stack_check_probe_2[DS]\n"
95 "stack_check_probe_2:\n"
96 " .long .stack_check_probe_2, TOC[tc0], 0\n"
97 " .csect .text[PR]\n"
98 ".stack_check_probe_2:\n"
99 " stw 0,-16384(1)\n"
100 " stw 0,-20480(1)\n"
101 " stw 0,-24576(1)\n"
102 " stw 0,-28672(1)\n"
103 " stw 0,-28752(1)\n"
104 " mflr 0\n"
105 " stw 31,-4(1)\n"
106 " stw 0,8(1)\n"
107 " stwu 1,-16464(1)\n"
108 " mr 31,1\n"
109 " lwz 1,0(1)\n"
110 " lwz 0,8(1)\n"
111 " mtlr 0\n"
112 " lwz 31,-4(1)\n"
113 " blr\n");
114
115/* Asm for procedure stack_check_probe_loop_1() and stack_check_probe_loop_2().
116
117 Similar to stack_check_probe_1, but with a different probing sequence
118 (probing loop). */
119
120asm (" .csect .text[PR]\n"
121 " .align 2\n"
122 " .globl stack_check_probe_loop_1\n"
123 " .globl .stack_check_probe_loop_1\n"
124 " .csect stack_check_probe_loop_1[DS]\n"
125 "stack_check_probe_loop_1:\n"
126 " .long .stack_check_probe_loop_1, TOC[tc0], 0\n"
127 " .csect .text[PR]\n"
128 ".stack_check_probe_loop_1:\n"
129 " addi 12,1,-12288\n"
130 " lis 0,-8\n"
131 " ori 0,0,4096\n"
132 " add 0,12,0\n"
133 "LPSRL1..0:\n"
134 " cmpw 0,12,0\n"
135 " beq 0,LPSRE1..0\n"
136 " addi 12,12,-4096\n"
137 " stw 0,0(12)\n"
138 " b LPSRL1..0\n"
139 "LPSRE1..0:\n"
140 " stw 0,-4080(12)\n"
141 " mflr 0\n"
142 " stw 31,-4(1)\n"
143 " stw 0,8(1)\n"
144 " lis 0,0xfff8\n"
145 " ori 0,0,16\n"
146 " stwux 1,1,0\n"
147 " mr 31,1\n"
148 " lwz 1,0(1)\n"
149 " lwz 0,8(1)\n"
150 " mtlr 0\n"
151 " lwz 31,-4(1)\n"
152 " blr\n");
153
154asm (" .csect .text[PR]\n"
155 " .align 2\n"
156 " .globl stack_check_probe_loop_2\n"
157 " .globl .stack_check_probe_loop_2\n"
158 " .csect stack_check_probe_loop_2[DS]\n"
159 "stack_check_probe_loop_2:\n"
160 " .long .stack_check_probe_loop_2, TOC[tc0], 0\n"
161 " .csect .text[PR]\n"
162 ".stack_check_probe_loop_2:\n"
163 " addi 12,1,-12288\n"
164 " lis 0,-8\n"
165 " add 0,12,0\n"
166 "LPSRL2..0:\n"
167 " cmpw 0,12,0\n"
168 " beq 0,LPSRE2..0\n"
169 " addi 12,12,-4096\n"
170 " stw 0,0(12)\n"
171 " b LPSRL2..0\n"
172 "LPSRE2..0:\n"
173 " mflr 0\n"
174 " stw 31,-4(1)\n"
175 " stw 0,8(1)\n"
176 " lis 0,0xfff8\n"
177 " ori 0,0,16\n"
178 " stwux 1,1,0\n"
179 " mr 31,1\n"
180 " lwz 1,0(1)\n"
181 " lwz 0,8(1)\n"
182 " mtlr 0\n"
183 " lwz 31,-4(1)\n"
184 " blr\n");