1 @c Copyright (C) 2000-2016 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
8 @chapter ARC Dependent Features
12 @node Machine Dependencies
13 @chapter ARC Dependent Features
16 @set ARC_CORE_DEFAULT 6
20 * ARC Options:: Options
22 * ARC Directives:: ARC Machine Directives
23 * ARC Modifiers:: ARC Assembler Modifiers
24 * ARC Symbols:: ARC Pre-defined Symbols
25 * ARC Opcodes:: Opcodes
31 @cindex options for ARC
33 The following options control the type of CPU for which code is
34 assembled, and generic constraints on the code generated:
39 @cindex @code{-mcpu=@var{cpu}} command line option, ARC
40 Set architecture type and register usage for @var{cpu}. There are
41 also shortcut alias options available for backward compatibility and
42 convenience. Supported values for @var{cpu} are
45 @cindex @code{mA6} command line option, ARC
46 @cindex @code{marc600} command line option, ARC
48 Assemble for ARC 600. Aliases: @code{-mA6}, @code{-mARC600}.
51 @cindex @code{mARC601} command line option, ARC
52 Assemble for ARC 601. Alias: @code{-mARC601}.
55 @cindex @code{mA7} command line option, ARC
56 @cindex @code{mARC700} command line option, ARC
57 Assemble for ARC 700. Aliases: @code{-mA7}, @code{-mARC700}.
60 @cindex @code{mEM} command line option, ARC
61 Assemble for ARC EM. Aliases: @code{-mEM}
64 @cindex @code{mHS} command line option, ARC
65 Assemble for ARC HS. Aliases: @code{-mHS}, @code{-mav2hs}.
69 Note: the @code{.cpu} directive can to be used to select a core
70 variant from within assembly code.
72 @cindex @code{-EB} command line option, ARC
74 This option specifies that the output generated by the assembler should
75 be marked as being encoded for a big-endian processor.
77 @cindex @code{-EL} command line option, ARC
79 This option specifies that the output generated by the assembler should
80 be marked as being encoded for a little-endian processor - this is the
83 @cindex @code{-mcode-density} command line option, ARC
85 This option turns on Code Density instructions. Only valid for ARC EM
88 @cindex @code{-mrelax} command line option, ARC
90 Enable support for assembly-time relaxation. The assembler will
91 replace a longer version of an instruction with a shorter one,
92 whenever it is possible.
99 * ARC-Chars:: Special Characters
100 * ARC-Regs:: Register Names
104 @subsection Special Characters
108 @cindex register name prefix character, ARC
109 @cindex ARC register name prefix character
110 A register name can optionally be prefixed by a @samp{%} character. So
111 register @code{%r0} is equivalent to @code{r0} in the assembly code.
114 @cindex line comment character, ARC
115 @cindex ARC line comment character
116 The presence of a @samp{#} character within a line (but not at the
117 start of a line) indicates the start of a comment that extends to the
118 end of the current line.
120 @emph{Note:} if a line starts with a @samp{#} character then it can
121 also be a logical line number directive (@pxref{Comments}) or a
122 preprocessor control command (@pxref{Preprocessing}).
125 @cindex symbol prefix character, ARC
126 @cindex ARC symbol prefix character
127 Prefixing an operand with an @samp{@@} specifies that the operand is a
128 symbol and not a register. This is how the assembler disambiguates
129 the use of an ARC register name as a symbol. So the instruction
133 moves the address of symbol @code{r0} into register @code{r0}.
136 @cindex line separator, ARC
137 @cindex statement separator, ARC
138 @cindex ARC line separator
139 The @samp{`} (backtick) character is used to separate statements on a
144 @cindex C preprocessor macro separator, ARC
145 @cindex ARC C preprocessor macro separator
146 Used as a separator to obtain a sequence of commands from a C
152 @subsection Register Names
154 @cindex ARC register names
155 @cindex register names, ARC
156 The ARC assembler uses the following register names for its core
161 @cindex core general registers, ARC
162 @cindex ARC core general registers
163 The core general registers. Registers @code{r26} through @code{r31}
164 have special functions, and are usually referred to by those synonyms.
167 @cindex global pointer, ARC
168 @cindex ARC global pointer
169 The global pointer and a synonym for @code{r26}.
172 @cindex frame pointer, ARC
173 @cindex ARC frame pointer
174 The frame pointer and a synonym for @code{r27}.
177 @cindex stack pointer, ARC
178 @cindex ARC stack pointer
179 The stack pointer and a synonym for @code{r28}.
182 @cindex level 1 interrupt link register, ARC
183 @cindex ARC level 1 interrupt link register
184 For ARC 600 and ARC 700, the level 1 interrupt link register and a
185 synonym for @code{r29}. Not supported for ARCv2.
188 @cindex interrupt link register, ARC
189 @cindex ARC interrupt link register
190 For ARCv2, the interrupt link register and a synonym for @code{r29}.
191 Not supported for ARC 600 and ARC 700.
194 @cindex level 2 interrupt link register, ARC
195 @cindex ARC level 2 interrupt link register
196 For ARC 600 and ARC 700, the level 2 interrupt link register and a
197 synonym for @code{r30}. Not supported for ARC v2.
200 @cindex link register, ARC
201 @cindex ARC link register
202 The link register and a synonym for @code{r31}.
205 @cindex extension core registers, ARC
206 @cindex ARC extension core registers
207 The extension core registers.
210 @cindex loop counter, ARC
211 @cindex ARC loop counter
212 The loop count register.
215 @cindex word aligned program counter, ARC
216 @cindex ARC word aligned program counter
217 The word aligned program counter.
221 In addition the ARC processor has a large number of @emph{auxiliary
222 registers}. The precise set depends on the extensions being
223 supported, but the following baseline set are always defined:
227 @cindex Processor Identification register, ARC
228 @cindex ARC Processor Identification register
229 Processor Identification register. Auxiliary register address 0x4.
232 @cindex Program Counter, ARC
233 @cindex ARC Program Counter
234 Program Counter. Auxiliary register address 0x6.
237 @cindex Status register, ARC
238 @cindex ARC Status register
239 Status register. Auxiliary register address 0x0a.
242 @cindex Branch Target Address, ARC
243 @cindex ARC Branch Target Address
244 Branch Target Address. Auxiliary register address 0x412.
247 @cindex Exception Cause Register, ARC
248 @cindex ARC Exception Cause Register
249 Exception Cause Register. Auxiliary register address 0x403.
251 @item int_vector_base
252 @cindex Interrupt Vector Base address, ARC
253 @cindex ARC Interrupt Vector Base address
254 Interrupt Vector Base address. Auxiliary register address 0x25.
257 @cindex Stored STATUS32 register on entry to level P0 interrupts, ARC
258 @cindex ARC Stored STATUS32 register on entry to level P0 interrupts
259 Stored STATUS32 register on entry to level P0 interrupts. Auxiliary
260 register address 0xb.
263 @cindex Saved User Stack Pointer, ARC
264 @cindex ARC Saved User Stack Pointer
265 Saved User Stack Pointer. Auxiliary register address 0xd.
268 @cindex Exception Return Address, ARC
269 @cindex ARC Exception Return Address
270 Exception Return Address. Auxiliary register address 0x400.
273 @cindex BTA saved on exception entry, ARC
274 @cindex ARC BTA saved on exception entry
275 BTA saved on exception entry. Auxiliary register address 0x401.
278 @cindex STATUS32 saved on exception, ARC
279 @cindex ARC STATUS32 saved on exception
280 STATUS32 saved on exception. Auxiliary register address 0x402.
283 @cindex Build Configuration Registers Version, ARC
284 @cindex ARC Build Configuration Registers Version
285 Build Configuration Registers Version. Auxiliary register address 0x60.
288 @cindex Build configuration for: BTA Registers, ARC
289 @cindex ARC Build configuration for: BTA Registers
290 Build configuration for: BTA Registers. Auxiliary register address 0x63.
292 @item vecbase_ac_build
293 @cindex Build configuration for: Interrupts, ARC
294 @cindex ARC Build configuration for: Interrupts
295 Build configuration for: Interrupts. Auxiliary register address 0x68.
298 @cindex Build configuration for: Core Registers, ARC
299 @cindex ARC Build configuration for: Core Registers
300 Build configuration for: Core Registers. Auxiliary register address 0x6e.
303 @cindex DCCM RAM Configuration Register, ARC
304 @cindex ARC DCCM RAM Configuration Register
305 DCCM RAM Configuration Register. Auxiliary register address 0xc1.
309 Additional auxiliary register names are defined according to the
310 processor architecture version and extensions selected by the options.
313 @section ARC Machine Directives
315 @cindex machine directives, ARC
316 @cindex ARC machine directives
317 The ARC version of @code{@value{AS}} supports the following additional
322 @cindex @code{lcomm} directive
323 @item .lcomm @var{symbol} , @var{length}[, @var{alignment}]
324 Reserve @var{length} (an absolute expression) bytes for a local common
325 denoted by @var{symbol}. The section and value of @var{symbol} are
326 those of the new local common. The addresses are allocated in the bss
327 section, so that at run-time the bytes start off zeroed. Since
328 @var{symbol} is not declared global, it is normally not visible to
329 @code{@value{LD}}. The optional third parameter, @var{alignment},
330 specifies the desired alignment of the symbol in the bss section,
331 specified as a byte boundary (for example, an alignment of 16 means
332 that the least significant 4 bits of the address should be zero). The
333 alignment must be an absolute expression, and it must be a power of
334 two. If no alignment is specified, as will set the alignment to the
335 largest power of two less than or equal to the size of the symbol, up
338 @cindex @code{lcommon} directive
339 @item .lcommon @var{symbol} , @var{length}[, @var{alignment}]
340 The same as @code{lcomm} directive.
342 @cindex @code{cpu} directive, ARC
343 @cindex @code{cpu} directive, ARC
344 The @code{.cpu} directive must be followed by the desired core
345 version. Permitted values for CPU are:
348 Assemble for the ARC600 instruction set.
351 Assemble for the ARC700 instruction set.
354 Assemble for the ARC EM instruction set.
357 Assemble for the ARC HS instruction set.
361 Note: the @code{.cpu} directive overrides the command line option
362 @code{-mcpu=@var{cpu}}; a warning is emitted when the version is not
363 consistent between the two.
367 @section ARC Assembler Modifiers
369 The following additional assembler modifiers have been added for
370 position-independent code. These modifiers are available only with
371 the ARC 700 and above processors and generate relocation entries,
372 which are interpreted by the linker as follows:
375 @item @@pcl(@var{symbol})
376 @cindex @@pcl(@var{symbol}), ARC modifier
377 Relative distance of @var{symbol}'s from the current program counter
380 @item @@gotpc(@var{symbol})
381 @cindex @@gotpc(@var{symbol}), ARC modifier
382 Relative distance of @var{symbol}'s Global Offset Table entry from the
383 current program counter location.
385 @item @@gotoff(@var{symbol})
386 @cindex @@gotoff(@var{symbol}), ARC modifier
387 Distance of @var{symbol} from the base of the Global Offset Table.
389 @item @@plt(@var{symbol})
390 @cindex @@plt(@var{symbol}), ARC modifier
391 Distance of @var{symbol}'s Procedure Linkage Table entry from the
392 current program counter. This is valid only with branch and link
393 instructions and PC-relative calls.
395 @item @@sda(@var{symbol})
396 @cindex @@sda(@var{symbol}), ARC modifier
397 Relative distance of @var{symbol} from the base of the Small Data
403 @section ARC Pre-defined Symbols
405 The following assembler symbols will prove useful when developing
406 position-independent code. These symbols are available only with the
407 ARC 700 and above processors.
410 @item __GLOBAL_OFFSET_TABLE__
411 @cindex __GLOBAL_OFFSET_TABLE__, ARC pre-defined symbol
412 Symbol referring to the base of the Global Offset Table.
415 @cindex __DYNAMIC__, ARC pre-defined symbol
416 An alias for the Global Offset Table
417 @code{Base__GLOBAL_OFFSET_TABLE__}. It can be used only with
418 @code{@@gotpc} modifiers.
426 @cindex opcodes for ARC
428 For information on the ARC instruction set, see @cite{ARC Programmers
429 Reference Manual}, available where you download the processor IP library.