]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/msp430/srai.S
MSP430: Put libgcc shift functions in their own section
[thirdparty/gcc.git] / libgcc / config / msp430 / srai.S
CommitLineData
fbd26352 1; Copyright (C) 2012-2019 Free Software Foundation, Inc.
e4a25868 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
d790a6d6 25 .section .text.__mspabi_srai_n
e4a25868 26 .macro _srai n
27 .global __mspabi_srai_\n
28__mspabi_srai_\n:
29 RRA.W R12
30 .endm
31
d790a6d6 32/* Arithmetic Right Shift - R12 -> R12. */
e4a25868 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
d790a6d6 54 .section .text.__mspabi_srai
e4a25868 551: 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
d790a6d6 67/* Arithmetic Right Shift - R12:R13 -> R12:R13. */
e4a25868 68
d790a6d6 69 .section .text.__mspabi_sral_n
e4a25868 70 .macro _sral n
71 .global __mspabi_sral_\n
72__mspabi_sral_\n:
73 RRA.W R13
74 RRC.W R12
75 .endm
76
77 _sral 15
78 _sral 14
79 _sral 13
80 _sral 12
81 _sral 11
82 _sral 10
83 _sral 9
84 _sral 8
85 _sral 7
86 _sral 6
87 _sral 5
88 _sral 4
89 _sral 3
90 _sral 2
91 _sral 1
92#ifdef __MSP430X_LARGE__
93 RETA
94#else
95 RET
96#endif
97
d790a6d6 98 .section .text.__mspabi_sral
e4a25868 991: ADD.W #-1,R14
100 RRA.W R13
101 RRC.W R12
102 .global __mspabi_sral
103__mspabi_sral:
104 CMP #0,R14
105 JNZ 1b
106#ifdef __MSP430X_LARGE__
107 RETA
108#else
109 RET
110#endif