]>
Commit | Line | Data |
---|---|---|
7adcbafe | 1 | ; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
f6a83b4a DD |
2 | ; Contributed by Red Hat. |
3 | ; | |
4 | ; This file is free software; you can redistribute it and/or modify it | |
5 | ; under the terms of the GNU General Public License as published by the | |
6 | ; Free Software Foundation; either version 3, or (at your option) any | |
7 | ; later version. | |
8 | ; | |
9 | ; This file is distributed in the hope that it will be useful, but | |
10 | ; WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | ; General Public License for more details. | |
13 | ; | |
14 | ; Under Section 7 of GPL version 3, you are granted additional | |
15 | ; permissions described in the GCC Runtime Library Exception, version | |
16 | ; 3.1, as published by the Free Software Foundation. | |
17 | ; | |
18 | ; You should have received a copy of the GNU General Public License and | |
19 | ; a copy of the GCC Runtime Library Exception along with this program; | |
20 | ; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
21 | ; <http://www.gnu.org/licenses/>. | |
22 | ||
23 | .text | |
24 | ||
d1b2f85f | 25 | .section .text.__mspabi_srai_n |
f6a83b4a DD |
26 | .macro _srai n |
27 | .global __mspabi_srai_\n | |
28 | __mspabi_srai_\n: | |
29 | RRA.W R12 | |
30 | .endm | |
31 | ||
d1b2f85f | 32 | /* Arithmetic Right Shift - R12 -> R12. */ |
f6a83b4a DD |
33 | _srai 15 |
34 | _srai 14 | |
35 | _srai 13 | |
36 | _srai 12 | |
37 | _srai 11 | |
38 | _srai 10 | |
39 | _srai 9 | |
40 | _srai 8 | |
41 | _srai 7 | |
42 | _srai 6 | |
43 | _srai 5 | |
44 | _srai 4 | |
45 | _srai 3 | |
46 | _srai 2 | |
47 | _srai 1 | |
48 | #ifdef __MSP430X_LARGE__ | |
49 | RETA | |
50 | #else | |
51 | RET | |
52 | #endif | |
53 | ||
d1b2f85f | 54 | .section .text.__mspabi_srai |
f6a83b4a DD |
55 | 1: ADD.W #-1,R13 |
56 | RRA.W R12,R12 | |
57 | .global __mspabi_srai | |
58 | __mspabi_srai: | |
59 | CMP #0,R13 | |
60 | JNZ 1b | |
61 | #ifdef __MSP430X_LARGE__ | |
62 | RETA | |
63 | #else | |
64 | RET | |
65 | #endif | |
66 | ||
703e049a JL |
67 | #ifdef __MSP430X__ |
68 | .section .text.__gnu_mspabi_srap | |
69 | 1: ADDA #-1,R13 | |
70 | RRAX.A R12,R12 | |
71 | .global __gnu_mspabi_srap | |
72 | __gnu_mspabi_srap: | |
73 | CMP #0,R13 | |
74 | JNZ 1b | |
75 | #ifdef __MSP430X_LARGE__ | |
76 | RETA | |
77 | #else | |
78 | RET | |
79 | #endif /* __MSP430X_LARGE__ */ | |
80 | #endif /* __MSP430X__ */ | |
81 | ||
d1b2f85f | 82 | /* Arithmetic Right Shift - R12:R13 -> R12:R13. */ |
f6a83b4a | 83 | |
d1b2f85f | 84 | .section .text.__mspabi_sral_n |
f6a83b4a DD |
85 | .macro _sral n |
86 | .global __mspabi_sral_\n | |
87 | __mspabi_sral_\n: | |
88 | RRA.W R13 | |
89 | RRC.W R12 | |
90 | .endm | |
91 | ||
92 | _sral 15 | |
93 | _sral 14 | |
94 | _sral 13 | |
95 | _sral 12 | |
96 | _sral 11 | |
97 | _sral 10 | |
98 | _sral 9 | |
99 | _sral 8 | |
100 | _sral 7 | |
101 | _sral 6 | |
102 | _sral 5 | |
103 | _sral 4 | |
104 | _sral 3 | |
105 | _sral 2 | |
106 | _sral 1 | |
107 | #ifdef __MSP430X_LARGE__ | |
108 | RETA | |
109 | #else | |
110 | RET | |
111 | #endif | |
112 | ||
d1b2f85f | 113 | .section .text.__mspabi_sral |
f6a83b4a DD |
114 | 1: ADD.W #-1,R14 |
115 | RRA.W R13 | |
116 | RRC.W R12 | |
117 | .global __mspabi_sral | |
118 | __mspabi_sral: | |
119 | CMP #0,R14 | |
120 | JNZ 1b | |
121 | #ifdef __MSP430X_LARGE__ | |
122 | RETA | |
123 | #else | |
124 | RET | |
125 | #endif | |
0fcc78f7 JL |
126 | |
127 | /* Arithmetic Right Shift - R8:R11 -> R12:R15 | |
128 | A 64-bit argument would normally be passed in R12:R15, but __mspabi_srall has | |
129 | special conventions, so the 64-bit value to shift is passed in R8:R11. | |
130 | According to the MSPABI, the shift amount is a 64-bit value in R12:R15, but | |
131 | we only use the low word in R12. */ | |
132 | ||
133 | .section .text.__mspabi_srall | |
134 | .global __mspabi_srall | |
135 | __mspabi_srall: | |
136 | MOV R11, R15 ; Free up R11 first | |
137 | MOV R12, R11 ; Save the shift amount in R11 | |
138 | MOV R10, R14 | |
139 | MOV R9, R13 | |
140 | MOV R8, R12 | |
141 | CMP #0, R11 | |
142 | JNZ 1f | |
143 | #ifdef __MSP430X_LARGE__ | |
144 | RETA | |
145 | #else | |
146 | RET | |
147 | #endif | |
148 | 1: | |
149 | RRA R15 | |
150 | RRC R14 | |
151 | RRC R13 | |
152 | RRC R12 | |
153 | ADD #-1,R11 | |
154 | JNZ 1b | |
155 | #ifdef __MSP430X_LARGE__ | |
156 | RETA | |
157 | #else | |
158 | RET | |
159 | #endif |