Import pre-release gcc-5.0 to new vendor branch
[dragonfly.git] / contrib / gcc-5.0 / libitm / config / sh / sjlj.S
1 /* Copyright (C) 2011-2015 Free Software Foundation, Inc.
2
3    This file is part of the GNU Transactional Memory Library (libitm).
4
5    Libitm is free software; you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
11    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13    more details.
14
15    Under Section 7 of GPL version 3, you are granted additional
16    permissions described in the GCC Runtime Library Exception, version
17    3.1, as published by the Free Software Foundation.
18
19    You should have received a copy of the GNU General Public License and
20    a copy of the GCC Runtime Library Exception along with this program;
21    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22    <http://www.gnu.org/licenses/>.  */
23
24 #include "asmcfi.h"
25
26         .text
27         .align  2
28         .global _ITM_beginTransaction
29         .type   _ITM_beginTransaction, %function
30
31 _ITM_beginTransaction:
32         cfi_startproc
33         mov     r15, r1
34 #ifdef __SH_FPU_ANY__
35         fmov.s  fr15, @-r15
36         fmov.s  fr14, @-r15
37         fmov.s  fr13, @-r15
38         fmov.s  fr12, @-r15
39         sts.l   fpscr, @-r15
40 #endif /* __SH_FPU_ANY__ */
41         stc.l   gbr, @-r15
42         sts.l   pr, @-r15
43         mov.l   r1, @-r15
44         mov.l   r14, @-r15
45         mov.l   r13, @-r15
46         mov.l   r12, @-r15
47         mov.l   r11, @-r15
48         mov.l   r10, @-r15
49         mov.l   r9, @-r15
50         mov.l   r8, @-r15
51 #ifdef __SH_FPU_ANY__
52         cfi_def_cfa_offset (4*15)
53 #else
54         cfi_def_cfa_offset (4*10)
55 #endif
56 #if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
57         mov.l   .Lbegin, r1
58         jsr     @r1
59          mov    r15, r5
60 #else
61         mova    .Lgot, r0
62         mov.l   .Lgot, r12
63         add     r0, r12
64         mov.l   .Lbegin, r1
65         bsrf    r1
66          mov    r15, r5
67 .Lbegin0:
68         mov.l   @(4*4,r15), r12
69 #endif
70         mov.l   @(8*4,r15), r1
71         lds     r1, pr
72 #ifdef __SH_FPU_ANY__
73         add     #(15*4), r15
74 #else
75         add     #(10*5), r15
76 #endif
77         cfi_def_cfa_offset (0)
78         rts
79          nop
80         cfi_endproc
81
82         .align  2
83 .Lgot:
84         .long   _GLOBAL_OFFSET_TABLE_
85 .Lbegin:
86 #if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
87         .long   GTM_begin_transaction
88 #else
89         .long   GTM_begin_transaction@PLT-(.Lbegin0-.)
90 #endif
91         .size   _ITM_beginTransaction, . - _ITM_beginTransaction
92
93         .global GTM_longjmp
94         .hidden GTM_longjmp
95         .type   GTM_longjmp, %function
96
97 GTM_longjmp:
98         mov.l   @r5+, r8
99         mov.l   @r5+, r9
100         mov.l   @r5+, r10
101         mov.l   @r5+, r11
102         mov.l   @r5+, r12
103         mov.l   @r5+, r13
104         mov.l   @r5+, r14
105         mov.l   @r5+, r15
106         lds.l   @r5+, pr
107         ldc.l   @r5+, gbr
108 #ifdef __SH_FPU_ANY__
109         lds.l   @r5+, fpscr
110         fmov.s  @r5+, fr12
111         fmov.s  @r5+, fr13
112         fmov.s  @r5+, fr14
113         fmov.s  @r5+, fr15
114 #endif
115         rts
116          mov    r4, r0
117
118         .size   GTM_longjmp, . - GTM_longjmp
119
120 #ifdef __linux__
121 .section .note.GNU-stack, "", %progbits
122 #endif