Coverage Report

Created: 2025-06-24 06:45

/src/binutils-gdb/include/opcode/arc-func.h
Line
Count
Source (jump to first uncovered line)
1
/* Replace functions for the ARC relocs.
2
   Copyright (C) 2015-2025 Free Software Foundation, Inc.
3
4
   This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
5
   the GNU Binutils.
6
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)
10
   any later version.
11
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.
16
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.  */
21
22
/* mask  = 00000000000000000000000000000000.  */
23
#ifndef REPLACE_none
24
#define REPLACE_none
25
ATTRIBUTE_UNUSED static unsigned
26
replace_none (unsigned insn, int value ATTRIBUTE_UNUSED)
27
0
{
28
0
  insn = insn & ~0x00;
29
30
0
  return insn;
31
0
}
32
33
#endif /* REPLACE_none */
34
35
/* mask  = 11111111.  */
36
#ifndef REPLACE_bits8
37
#define REPLACE_bits8
38
ATTRIBUTE_UNUSED static unsigned
39
replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED)
40
0
{
41
0
  insn = insn & ~0xff;
42
0
  insn |= ((value >> 0) & 0x00ff) << 0;
43
44
0
  return insn;
45
0
}
46
47
#endif /* REPLACE_bits8 */
48
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)
54
0
{
55
0
  insn = insn & ~0xffff;
56
0
  insn |= ((value >> 0) & 0xffff) << 0;
57
58
0
  return insn;
59
0
}
60
61
#endif /* REPLACE_bits16 */
62
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)
68
0
{
69
0
  insn = insn & ~0xffffff;
70
0
  insn |= ((value >> 0) & 0xffffff) << 0;
71
72
0
  return insn;
73
0
}
74
75
#endif /* REPLACE_bits24 */
76
77
/* Special 24 bit replace for big endian.  */
78
/* mask  = 111111111111111111111111.  */
79
#ifndef REPLACE_bits24_be
80
#define REPLACE_bits24_be
81
ATTRIBUTE_UNUSED static unsigned
82
replace_bits24_be (unsigned insn, int value ATTRIBUTE_UNUSED)
83
0
{
84
0
  insn = insn & ~0xffffff00;
85
0
  insn |= ((value >> 0) & 0xffffff) << 8;
86
87
0
  return insn;
88
0
}
89
90
#endif /* REPLACE_bits24_be */
91
92
/* mask  = 11111111111111111111111111111111.  */
93
#ifndef REPLACE_word32
94
#define REPLACE_word32
95
ATTRIBUTE_UNUSED static unsigned
96
replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED)
97
0
{
98
0
  insn = insn & ~0xffffffff;
99
0
  insn |= ((value >> 0) & 0xffffffff) << 0;
100
101
0
  return insn;
102
0
}
103
104
#endif /* REPLACE_word32 */
105
106
/* mask  = 0000000000000000000000000000000011111111111111111111111111111111.  */
107
#ifndef REPLACE_limm
108
#define REPLACE_limm
109
ATTRIBUTE_UNUSED static unsigned
110
replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED)
111
0
{
112
0
  insn = insn & ~0xffffffff;
113
0
  insn |= ((value >> 0) & 0xffffffff) << 0;
114
115
0
  return insn;
116
0
}
117
118
#endif /* REPLACE_limm */
119
120
/* mask  = 000000000000000011111111111111111111111111111111.  */
121
#ifndef REPLACE_limms
122
#define REPLACE_limms
123
ATTRIBUTE_UNUSED static unsigned
124
replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED)
125
0
{
126
0
  insn = insn & ~0xffffffff;
127
0
  insn |= ((value >> 0) & 0xffffffff) << 0;
128
129
0
  return insn;
130
0
}
131
132
#endif /* REPLACE_limms */
133
134
/* mask  = 00000111111111102222222222000000.  */
135
#ifndef REPLACE_disp21h
136
#define REPLACE_disp21h
137
ATTRIBUTE_UNUSED static unsigned
138
replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED)
139
0
{
140
0
  insn = insn & ~0x7feffc0;
141
0
  insn |= ((value >> 0) & 0x03ff) << 17;
142
0
  insn |= ((value >> 10) & 0x03ff) << 6;
143
144
0
  return insn;
145
0
}
146
147
#endif /* REPLACE_disp21h */
148
149
/* mask  = 00000111111111002222222222000000.  */
150
#ifndef REPLACE_disp21w
151
#define REPLACE_disp21w
152
ATTRIBUTE_UNUSED static unsigned
153
replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED)
154
0
{
155
0
  insn = insn & ~0x7fcffc0;
156
0
  insn |= ((value >> 0) & 0x01ff) << 18;
157
0
  insn |= ((value >> 9) & 0x03ff) << 6;
158
159
0
  return insn;
160
0
}
161
162
#endif /* REPLACE_disp21w */
163
164
/* mask  = 00000111111111102222222222003333.  */
165
#ifndef REPLACE_disp25h
166
#define REPLACE_disp25h
167
ATTRIBUTE_UNUSED static unsigned
168
replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED)
169
0
{
170
0
  insn = insn & ~0x7feffcf;
171
0
  insn |= ((value >> 0) & 0x03ff) << 17;
172
0
  insn |= ((value >> 10) & 0x03ff) << 6;
173
0
  insn |= ((value >> 20) & 0x000f) << 0;
174
175
0
  return insn;
176
0
}
177
178
#endif /* REPLACE_disp25h */
179
180
/* mask  = 00000111111111002222222222003333.  */
181
#ifndef REPLACE_disp25w
182
#define REPLACE_disp25w
183
ATTRIBUTE_UNUSED static unsigned
184
replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED)
185
0
{
186
0
  insn = insn & ~0x7fcffcf;
187
0
  insn |= ((value >> 0) & 0x01ff) << 18;
188
0
  insn |= ((value >> 9) & 0x03ff) << 6;
189
0
  insn |= ((value >> 19) & 0x000f) << 0;
190
191
0
  return insn;
192
0
}
193
194
#endif /* REPLACE_disp25w */
195
196
/* mask  = 00000000000000000000000111111111.  */
197
#ifndef REPLACE_disp9
198
#define REPLACE_disp9
199
ATTRIBUTE_UNUSED static unsigned
200
replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED)
201
0
{
202
0
  insn = insn & ~0x1ff;
203
0
  insn |= ((value >> 0) & 0x01ff) << 0;
204
205
0
  return insn;
206
0
}
207
208
#endif /* REPLACE_disp9 */
209
210
/* mask  = 00000000111111112000000000000000.  */
211
#ifndef REPLACE_disp9ls
212
#define REPLACE_disp9ls
213
ATTRIBUTE_UNUSED static unsigned
214
replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED)
215
0
{
216
0
  insn = insn & ~0xff8000;
217
0
  insn |= ((value >> 0) & 0x00ff) << 16;
218
0
  insn |= ((value >> 8) & 0x0001) << 15;
219
220
0
  return insn;
221
0
}
222
223
#endif /* REPLACE_disp9ls */
224
225
/* mask  = 0000000111111111.  */
226
#ifndef REPLACE_disp9s
227
#define REPLACE_disp9s
228
ATTRIBUTE_UNUSED static unsigned
229
replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED)
230
0
{
231
0
  insn = insn & ~0x1ff;
232
0
  insn |= ((value >> 0) & 0x01ff) << 0;
233
234
0
  return insn;
235
0
}
236
237
#endif /* REPLACE_disp9s */
238
239
/* mask  = 0000011111111111.  */
240
#ifndef REPLACE_disp13s
241
#define REPLACE_disp13s
242
ATTRIBUTE_UNUSED static unsigned
243
replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED)
244
0
{
245
0
  insn = insn & ~0x7ff;
246
0
  insn |= ((value >> 0) & 0x07ff) << 0;
247
248
0
  return insn;
249
0
}
250
251
#endif /* REPLACE_disp13s */
252
253
/* mask  = 0000022222200111.  */
254
#ifndef REPLACE_disp9s1
255
#define REPLACE_disp9s1
256
ATTRIBUTE_UNUSED static unsigned
257
replace_disp9s1 (unsigned insn, int value ATTRIBUTE_UNUSED)
258
0
{
259
0
  insn = insn & ~0x7e7;
260
0
  insn |= ((value >> 0) & 0x0007) << 0;
261
0
  insn |= ((value >> 3) & 0x003f) << 5;
262
263
0
  return insn;
264
0
}
265
266
#endif /* REPLACE_disp9s1 */
267
268
/* mask  = 00000000000000000000111111222222.  */
269
#ifndef REPLACE_disp12s
270
#define REPLACE_disp12s
271
ATTRIBUTE_UNUSED static unsigned
272
replace_disp12s (unsigned insn, int value ATTRIBUTE_UNUSED)
273
0
{
274
0
  insn = insn & ~0xfff;
275
0
  insn |= ((value >> 0) & 0x003f) << 6;
276
0
  insn |= ((value >> 6) & 0x003f) << 0;
277
0
  return insn;
278
0
}
279
280
#endif /* REPLACE_disp12s */
281
282
/* mask  = 0000001111111111.  */
283
#ifndef REPLACE_jli
284
#define REPLACE_jli
285
ATTRIBUTE_UNUSED static unsigned
286
replace_jli (unsigned insn, int value)
287
0
{
288
0
  insn = insn & ~0x3ff;
289
0
  insn |= ((value >> 0) & 0x03ff) << 0;
290
291
0
  return insn;
292
0
}
293
294
#endif /* REPLACE_jli */