]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/powerpc64-prologue.c
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc64-prologue.c
CommitLineData
7f2b8718
WS
1/* Unwinder test program.
2
1d506c26 3 Copyright 2006-2024 Free Software Foundation, Inc.
7f2b8718
WS
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifdef SYMBOL_PREFIX
21#define SYMBOL(str) SYMBOL_PREFIX #str
22#else
23#define SYMBOL(str) #str
24#endif
25
26void gdb2029 (void);
27void optimized_1 (void);
28
29int
30main (void)
31{
32 gdb2029 ();
33 optimized_1 ();
34 return 0;
35}
36
37void
38optimized_1_marker (void)
39{
40}
41
42void
43gdb2029_marker (void)
44{
45}
46
47/* A typical PIC prologue from GCC. */
48/* This is a ppc64(le) variation of the code as seen
49 in powerpc-prologue.c. */
50
51asm(".text\n"
52 " .p2align 3\n"
53 SYMBOL (gdb2029) ":\n"
54 " mflr %r0\n"
55 " std %r0,16(%r1)\n"
56 " std %r31,-8(%r1)\n"
57 " stdu %r1,-128(%r1)\n"
58 " mr %r31,%r1\n"
59 " mr %r9,%r3\n"
60 " stw %r9,176(%r31)\n"
61 " lwz %r9,176(%r31)\n"
62 " bl gdb2029_marker\n"
63 " nop\n"
64 " mr %r9,%r3\n"
65 " mr %r3,%r9\n"
66 " addi %r1,%r31,128\n"
67 " ld %r0,16(%r1)\n"
68 " mtlr %r0\n"
69 " ld %r31,-8(%r1)\n"
70 " blr");
71
72/* A heavily scheduled prologue. */
73asm(".text\n"
74 " .p2align 3\n"
75 SYMBOL (optimized_1) ":\n"
76 " stdu %r1,-32(%r1)\n"
77 " lis %r9,-16342\n"
78 " lis %r11,-16342\n"
79 " mflr %r0\n"
80 " addi %r11,%r11,3776\n"
81 " std %r30,12(%r1)\n"
82 " addi %r31,%r9,3152\n"
83 " cmplw %cr7,%r31,%r11\n"
84 " std %r0,36(%r1)\n"
85 " mr %r30,%r3\n"
86 " bl optimized_1_marker\n"
87 " nop \n"
88 " ld %r0,36(%r1)\n"
89 " mtlr %r0\n"
90 " ld %r30,12(%r1)\n"
91 " addi %r1,%r1,32\n"
92 " blr");