]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - include/opcode/arc-func.h
1 /* Replace functions for the ARC relocs.
2 Copyright (C) 2015-2016 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
7 GAS/GDB is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GAS/GDB is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS or GDB; see the file COPYING3. If not, write to
19 the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
22 /* mask = 00000000000000000000000000000000. */
25 ATTRIBUTE_UNUSED
static unsigned
26 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
)
42 insn
|= ((value
>> 0) & 0x00ff) << 0;
47 #endif /* REPLACE_bits8 */
49 /* mask = 1111111111111111. */
50 #ifndef REPLACE_bits16
51 #define REPLACE_bits16
52 ATTRIBUTE_UNUSED
static unsigned
53 replace_bits16 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
55 insn
= insn
& ~0xffff;
56 insn
|= ((value
>> 0) & 0xffff) << 0;
61 #endif /* REPLACE_bits16 */
63 /* mask = 111111111111111111111111. */
64 #ifndef REPLACE_bits24
65 #define REPLACE_bits24
66 ATTRIBUTE_UNUSED
static unsigned
67 replace_bits24 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
69 insn
= insn
& ~0xffffff;
70 insn
|= ((value
>> 0) & 0xffffff) << 0;
75 #endif /* REPLACE_bits24 */
77 /* mask = 11111111111111111111111111111111. */
78 #ifndef REPLACE_word32
79 #define REPLACE_word32
80 ATTRIBUTE_UNUSED
static unsigned
81 replace_word32 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
83 insn
= insn
& ~0xffffffff;
84 insn
|= ((value
>> 0) & 0xffffffff) << 0;
89 #endif /* REPLACE_word32 */
91 /* mask = 0000000000000000000000000000000011111111111111111111111111111111. */
94 ATTRIBUTE_UNUSED
static unsigned
95 replace_limm (unsigned insn
, int value ATTRIBUTE_UNUSED
)
97 insn
= insn
& ~0xffffffff;
98 insn
|= ((value
>> 0) & 0xffffffff) << 0;
103 #endif /* REPLACE_limm */
105 /* mask = 000000000000000011111111111111111111111111111111. */
106 #ifndef REPLACE_limms
107 #define REPLACE_limms
108 ATTRIBUTE_UNUSED
static unsigned
109 replace_limms (unsigned insn
, int value ATTRIBUTE_UNUSED
)
111 insn
= insn
& ~0xffffffff;
112 insn
|= ((value
>> 0) & 0xffffffff) << 0;
117 #endif /* REPLACE_limms */
119 /* mask = 00000111111111102222222222000000. */
120 #ifndef REPLACE_disp21h
121 #define REPLACE_disp21h
122 ATTRIBUTE_UNUSED
static unsigned
123 replace_disp21h (unsigned insn
, int value ATTRIBUTE_UNUSED
)
125 insn
= insn
& ~0x7feffc0;
126 insn
|= ((value
>> 0) & 0x03ff) << 17;
127 insn
|= ((value
>> 10) & 0x03ff) << 6;
132 #endif /* REPLACE_disp21h */
134 /* mask = 00000111111111002222222222000000. */
135 #ifndef REPLACE_disp21w
136 #define REPLACE_disp21w
137 ATTRIBUTE_UNUSED
static unsigned
138 replace_disp21w (unsigned insn
, int value ATTRIBUTE_UNUSED
)
140 insn
= insn
& ~0x7fcffc0;
141 insn
|= ((value
>> 0) & 0x01ff) << 18;
142 insn
|= ((value
>> 9) & 0x03ff) << 6;
147 #endif /* REPLACE_disp21w */
149 /* mask = 00000111111111102222222222003333. */
150 #ifndef REPLACE_disp25h
151 #define REPLACE_disp25h
152 ATTRIBUTE_UNUSED
static unsigned
153 replace_disp25h (unsigned insn
, int value ATTRIBUTE_UNUSED
)
155 insn
= insn
& ~0x7feffcf;
156 insn
|= ((value
>> 0) & 0x03ff) << 17;
157 insn
|= ((value
>> 10) & 0x03ff) << 6;
158 insn
|= ((value
>> 20) & 0x000f) << 0;
163 #endif /* REPLACE_disp25h */
165 /* mask = 00000111111111002222222222003333. */
166 #ifndef REPLACE_disp25w
167 #define REPLACE_disp25w
168 ATTRIBUTE_UNUSED
static unsigned
169 replace_disp25w (unsigned insn
, int value ATTRIBUTE_UNUSED
)
171 insn
= insn
& ~0x7fcffcf;
172 insn
|= ((value
>> 0) & 0x01ff) << 18;
173 insn
|= ((value
>> 9) & 0x03ff) << 6;
174 insn
|= ((value
>> 19) & 0x000f) << 0;
179 #endif /* REPLACE_disp25w */
181 /* mask = 00000000000000000000000111111111. */
182 #ifndef REPLACE_disp9
183 #define REPLACE_disp9
184 ATTRIBUTE_UNUSED
static unsigned
185 replace_disp9 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
187 insn
= insn
& ~0x1ff;
188 insn
|= ((value
>> 0) & 0x01ff) << 0;
193 #endif /* REPLACE_disp9 */
195 /* mask = 00000000111111112000000000000000. */
196 #ifndef REPLACE_disp9ls
197 #define REPLACE_disp9ls
198 ATTRIBUTE_UNUSED
static unsigned
199 replace_disp9ls (unsigned insn
, int value ATTRIBUTE_UNUSED
)
201 insn
= insn
& ~0xff8000;
202 insn
|= ((value
>> 0) & 0x00ff) << 16;
203 insn
|= ((value
>> 8) & 0x0001) << 15;
208 #endif /* REPLACE_disp9ls */
210 /* mask = 0000000111111111. */
211 #ifndef REPLACE_disp9s
212 #define REPLACE_disp9s
213 ATTRIBUTE_UNUSED
static unsigned
214 replace_disp9s (unsigned insn
, int value ATTRIBUTE_UNUSED
)
216 insn
= insn
& ~0x1ff;
217 insn
|= ((value
>> 0) & 0x01ff) << 0;
222 #endif /* REPLACE_disp9s */
224 /* mask = 0000011111111111. */
225 #ifndef REPLACE_disp13s
226 #define REPLACE_disp13s
227 ATTRIBUTE_UNUSED
static unsigned
228 replace_disp13s (unsigned insn
, int value ATTRIBUTE_UNUSED
)
230 insn
= insn
& ~0x7ff;
231 insn
|= ((value
>> 0) & 0x07ff) << 0;
236 #endif /* REPLACE_disp13s */
238 /* mask = 0000022222200111. */
239 #ifndef REPLACE_disp9s1
240 #define REPLACE_disp9s1
241 ATTRIBUTE_UNUSED
static unsigned
242 replace_disp9s1 (unsigned insn
, int value ATTRIBUTE_UNUSED
)
244 insn
= insn
& ~0x7e7;
245 insn
|= ((value
>> 0) & 0x0007) << 0;
246 insn
|= ((value
>> 3) & 0x003f) << 5;
251 #endif /* REPLACE_disp9s1 */