Import pre-release gcc-5.0 to new vendor branch
[dragonfly.git] / contrib / gcc-5.0 / libitm / config / aarch64 / sjlj.S
1 /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
2    Contributed by Richard Henderson <rth@redhat.com>.
3
4    This file is part of the GNU Transactional Memory Library (libitm).
5
6    Libitm is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
12    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14    more details.
15
16    Under Section 7 of GPL version 3, you are granted additional
17    permissions described in the GCC Runtime Library Exception, version
18    3.1, as published by the Free Software Foundation.
19
20    You should have received a copy of the GNU General Public License and
21    a copy of the GCC Runtime Library Exception along with this program;
22    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23    <http://www.gnu.org/licenses/>.  */
24
25 #include "asmcfi.h"
26
27         .text
28         .align  2
29         .global _ITM_beginTransaction
30         .type   _ITM_beginTransaction, %function
31
32 _ITM_beginTransaction:
33         cfi_startproc
34         mov     x1, sp
35         stp     x29, x30, [sp, -11*16]!
36         cfi_adjust_cfa_offset(11*16)
37         cfi_rel_offset(x29, 0)
38         cfi_rel_offset(x30, 8)
39         mov     x29, sp
40         stp     x19, x20, [sp, 1*16]
41         stp     x21, x22, [sp, 2*16]
42         stp     x23, x24, [sp, 3*16]
43         stp     x25, x26, [sp, 4*16]
44         stp     x27, x28, [sp, 5*16]
45         stp     d8, d9,   [sp, 6*16]
46         stp     d10, d11, [sp, 7*16]
47         stp     d12, d13, [sp, 8*16]
48         stp     d14, d15, [sp, 9*16]
49         str     x1, [sp, 10*16]
50
51         /* Invoke GTM_begin_transaction with the struct we just built.  */
52         mov     x1, sp
53         bl      GTM_begin_transaction
54
55         /* Return; we don't need to restore any of the call-saved regs.  */
56         ldp     x29, x30, [sp], 11*16
57         cfi_adjust_cfa_offset(-11*16)
58         cfi_restore(x29)
59         cfi_restore(x30)
60         ret
61         cfi_endproc
62         .size   _ITM_beginTransaction, . - _ITM_beginTransaction
63
64         .align  2
65         .global GTM_longjmp
66         .hidden GTM_longjmp
67         .type   GTM_longjmp, %function
68
69 GTM_longjmp:
70         /* The first parameter becomes the return value (x0).
71            The third parameter is ignored for now.  */
72         cfi_startproc
73         ldp     x19, x20, [x1, 1*16]
74         ldp     x21, x22, [x1, 2*16]
75         ldp     x23, x24, [x1, 3*16]
76         ldp     x25, x26, [x1, 4*16]
77         ldp     x27, x28, [x1, 5*16]
78         ldp     d8, d9,   [x1, 6*16]
79         ldp     d10, d11, [x1, 7*16]
80         ldp     d12, d13, [x1, 8*16]
81         ldp     d14, d15, [x1, 9*16]
82         ldr     x3, [x1, 10*16]
83         ldp     x29, x30, [x1]
84         cfi_def_cfa(x1, 0)
85         mov     sp, x3
86         br      x30
87         cfi_endproc
88         .size   GTM_longjmp, . - GTM_longjmp
89
90 #ifdef __linux__
91 .section .note.GNU-stack, "", %progbits
92 #endif