1 /* Replace functions for the ARC relocs.
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
8 GAS/GDB is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GAS/GDB is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS or GDB; see the file COPYING3. If not, write to
20 the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
23 /* mask = 00000000000000000000000000000000. */
26 ATTRIBUTE_UNUSED
static unsigned
27 replace_none (unsigned insn
, int value ATTRIBUTE_UNUSED
)
33 #endif /* REPLACE_none */
35 /* mask = 11111111. */
38 ATTRIBUTE_UNUSED
static unsigned
39 replace_bits8 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
41 insn
|= ((value
>> 0) & 0x00ff) << 0;
46 #endif /* REPLACE_bits8 */
48 /* mask = 1111111111111111. */
49 #ifndef REPLACE_bits16
50 #define REPLACE_bits16
51 ATTRIBUTE_UNUSED
static unsigned
52 replace_bits16 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
54 insn
|= ((value
>> 0) & 0xffff) << 0;
59 #endif /* REPLACE_bits16 */
61 /* mask = 111111111111111111111111. */
62 #ifndef REPLACE_bits24
63 #define REPLACE_bits24
64 ATTRIBUTE_UNUSED
static unsigned
65 replace_bits24 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
67 insn
|= ((value
>> 0) & 0xffffff) << 0;
72 #endif /* REPLACE_bits24 */
74 /* mask = 11111111111111111111111111111111. */
75 #ifndef REPLACE_word32
76 #define REPLACE_word32
77 ATTRIBUTE_UNUSED
static unsigned
78 replace_word32 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
80 insn
|= ((value
>> 0) & 0xffffffff) << 0;
85 #endif /* REPLACE_word32 */
87 /* mask = 0000000000000000000000000000000011111111111111111111111111111111. */
90 ATTRIBUTE_UNUSED
static unsigned
91 replace_limm (unsigned insn
, int value ATTRIBUTE_UNUSED
)
93 insn
|= ((value
>> 0) & 0xffffffff) << 0;
98 #endif /* REPLACE_limm */
100 /* mask = 000000000000000011111111111111111111111111111111. */
101 #ifndef REPLACE_limms
102 #define REPLACE_limms
103 ATTRIBUTE_UNUSED
static unsigned
104 replace_limms (unsigned insn
, int value ATTRIBUTE_UNUSED
)
106 insn
|= ((value
>> 0) & 0xffffffff) << 0;
111 #endif /* REPLACE_limms */
113 /* mask = 00000111111111102222222222000000. */
114 #ifndef REPLACE_disp21h
115 #define REPLACE_disp21h
116 ATTRIBUTE_UNUSED
static unsigned
117 replace_disp21h (unsigned insn
, int value ATTRIBUTE_UNUSED
)
119 insn
|= ((value
>> 0) & 0x03ff) << 17;
120 insn
|= ((value
>> 10) & 0x03ff) << 6;
125 #endif /* REPLACE_disp21h */
127 /* mask = 00000111111111002222222222000000. */
128 #ifndef REPLACE_disp21w
129 #define REPLACE_disp21w
130 ATTRIBUTE_UNUSED
static unsigned
131 replace_disp21w (unsigned insn
, int value ATTRIBUTE_UNUSED
)
133 insn
|= ((value
>> 0) & 0x01ff) << 18;
134 insn
|= ((value
>> 9) & 0x03ff) << 6;
139 #endif /* REPLACE_disp21w */
141 /* mask = 00000111111111102222222222003333. */
142 #ifndef REPLACE_disp25h
143 #define REPLACE_disp25h
144 ATTRIBUTE_UNUSED
static unsigned
145 replace_disp25h (unsigned insn
, int value ATTRIBUTE_UNUSED
)
147 insn
|= ((value
>> 0) & 0x03ff) << 17;
148 insn
|= ((value
>> 10) & 0x03ff) << 6;
149 insn
|= ((value
>> 20) & 0x000f) << 0;
154 #endif /* REPLACE_disp25h */
156 /* mask = 00000111111111002222222222003333. */
157 #ifndef REPLACE_disp25w
158 #define REPLACE_disp25w
159 ATTRIBUTE_UNUSED
static unsigned
160 replace_disp25w (unsigned insn
, int value ATTRIBUTE_UNUSED
)
162 insn
|= ((value
>> 0) & 0x01ff) << 18;
163 insn
|= ((value
>> 9) & 0x03ff) << 6;
164 insn
|= ((value
>> 19) & 0x000f) << 0;
169 #endif /* REPLACE_disp25w */
171 /* mask = 00000000000000000000000111111111. */
172 #ifndef REPLACE_disp9
173 #define REPLACE_disp9
174 ATTRIBUTE_UNUSED
static unsigned
175 replace_disp9 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
177 insn
|= ((value
>> 0) & 0x01ff) << 0;
182 #endif /* REPLACE_disp9 */
184 /* mask = 00000000111111112000000000000000. */
185 #ifndef REPLACE_disp9ls
186 #define REPLACE_disp9ls
187 ATTRIBUTE_UNUSED
static unsigned
188 replace_disp9ls (unsigned insn
, int value ATTRIBUTE_UNUSED
)
190 insn
|= ((value
>> 0) & 0x00ff) << 16;
191 insn
|= ((value
>> 8) & 0x0001) << 15;
196 #endif /* REPLACE_disp9ls */
198 /* mask = 0000000111111111. */
199 #ifndef REPLACE_disp9s
200 #define REPLACE_disp9s
201 ATTRIBUTE_UNUSED
static unsigned
202 replace_disp9s (unsigned insn
, int value ATTRIBUTE_UNUSED
)
204 insn
|= ((value
>> 0) & 0x01ff) << 0;
209 #endif /* REPLACE_disp9s */
211 /* mask = 0000011111111111. */
212 #ifndef REPLACE_disp13s
213 #define REPLACE_disp13s
214 ATTRIBUTE_UNUSED
static unsigned
215 replace_disp13s (unsigned insn
, int value ATTRIBUTE_UNUSED
)
217 insn
|= ((value
>> 0) & 0x07ff) << 0;
222 #endif /* REPLACE_disp13s */
224 /* mask = 0000022222200111. */
225 #ifndef REPLACE_disp9s1
226 #define REPLACE_disp9s1
227 ATTRIBUTE_UNUSED
static unsigned
228 replace_disp9s1 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
230 insn
|= ((value
>> 0) & 0x0007) << 0;
231 insn
|= ((value
>> 3) & 0x003f) << 5;
236 #endif /* REPLACE_disp9s1 */