xref: /dflybsd-src/contrib/binutils-2.27/gas/doc/c-arc.texi (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj@c Copyright (C) 2000-2016 Free Software Foundation, Inc.
2*a9fa9459Szrj@c This is part of the GAS manual.
3*a9fa9459Szrj@c For copying conditions, see the file as.texinfo.
4*a9fa9459Szrj
5*a9fa9459Szrj@ifset GENERIC
6*a9fa9459Szrj@page
7*a9fa9459Szrj@node ARC-Dependent
8*a9fa9459Szrj@chapter ARC Dependent Features
9*a9fa9459Szrj@end ifset
10*a9fa9459Szrj
11*a9fa9459Szrj@ifclear GENERIC
12*a9fa9459Szrj@node Machine Dependencies
13*a9fa9459Szrj@chapter ARC Dependent Features
14*a9fa9459Szrj@end ifclear
15*a9fa9459Szrj
16*a9fa9459Szrj@set ARC_CORE_DEFAULT 6
17*a9fa9459Szrj
18*a9fa9459Szrj@cindex ARC support
19*a9fa9459Szrj@menu
20*a9fa9459Szrj* ARC Options::              Options
21*a9fa9459Szrj* ARC Syntax::               Syntax
22*a9fa9459Szrj* ARC Directives::           ARC Machine Directives
23*a9fa9459Szrj* ARC Modifiers::            ARC Assembler Modifiers
24*a9fa9459Szrj* ARC Symbols::              ARC Pre-defined Symbols
25*a9fa9459Szrj* ARC Opcodes::              Opcodes
26*a9fa9459Szrj@end menu
27*a9fa9459Szrj
28*a9fa9459Szrj@node ARC Options
29*a9fa9459Szrj@section Options
30*a9fa9459Szrj@cindex ARC options
31*a9fa9459Szrj@cindex options for ARC
32*a9fa9459Szrj
33*a9fa9459SzrjThe following options control the type of CPU for which code is
34*a9fa9459Szrjassembled, and generic constraints on the code generated:
35*a9fa9459Szrj
36*a9fa9459Szrj@table @code
37*a9fa9459Szrj
38*a9fa9459Szrj@item -mcpu=@var{cpu}
39*a9fa9459Szrj@cindex @code{-mcpu=@var{cpu}} command line option, ARC
40*a9fa9459SzrjSet architecture type and register usage for @var{cpu}.  There are
41*a9fa9459Szrjalso shortcut alias options available for backward compatibility and
42*a9fa9459Szrjconvenience.  Supported values for @var{cpu} are
43*a9fa9459Szrj
44*a9fa9459Szrj@table @code
45*a9fa9459Szrj@cindex @code{mA6} command line option, ARC
46*a9fa9459Szrj@cindex @code{marc600} command line option, ARC
47*a9fa9459Szrj@item arc600
48*a9fa9459SzrjAssemble for ARC 600.  Aliases: @code{-mA6}, @code{-mARC600}.
49*a9fa9459Szrj
50*a9fa9459Szrj@item arc601
51*a9fa9459Szrj@cindex @code{mARC601} command line option, ARC
52*a9fa9459SzrjAssemble for ARC 601.  Alias: @code{-mARC601}.
53*a9fa9459Szrj
54*a9fa9459Szrj@item arc700
55*a9fa9459Szrj@cindex @code{mA7} command line option, ARC
56*a9fa9459Szrj@cindex @code{mARC700} command line option, ARC
57*a9fa9459SzrjAssemble for ARC 700.  Aliases: @code{-mA7}, @code{-mARC700}.
58*a9fa9459Szrj
59*a9fa9459Szrj@item arcem
60*a9fa9459Szrj@cindex @code{mEM} command line option, ARC
61*a9fa9459SzrjAssemble for ARC EM.  Aliases: @code{-mEM}
62*a9fa9459Szrj
63*a9fa9459Szrj@item archs
64*a9fa9459Szrj@cindex @code{mHS} command line option, ARC
65*a9fa9459SzrjAssemble for ARC HS.  Aliases: @code{-mHS}, @code{-mav2hs}.
66*a9fa9459Szrj
67*a9fa9459Szrj@item nps400
68*a9fa9459Szrj@cindex @code{mnps400} command line option, ARC
69*a9fa9459SzrjAssemble for ARC 700 with NPS-400 extended instructions.
70*a9fa9459Szrj
71*a9fa9459Szrj@end table
72*a9fa9459Szrj
73*a9fa9459SzrjNote: the @code{.cpu} directive (@pxref{ARC Directives}) can
74*a9fa9459Szrjto be used to select a core variant from within assembly code.
75*a9fa9459Szrj
76*a9fa9459Szrj@cindex @code{-EB} command line option, ARC
77*a9fa9459Szrj@item -EB
78*a9fa9459SzrjThis option specifies that the output generated by the assembler should
79*a9fa9459Szrjbe marked as being encoded for a big-endian processor.
80*a9fa9459Szrj
81*a9fa9459Szrj@cindex @code{-EL} command line option, ARC
82*a9fa9459Szrj@item -EL
83*a9fa9459SzrjThis option specifies that the output generated by the assembler should
84*a9fa9459Szrjbe marked as being encoded for a little-endian processor - this is the
85*a9fa9459Szrjdefault.
86*a9fa9459Szrj
87*a9fa9459Szrj@cindex @code{-mcode-density} command line option, ARC
88*a9fa9459Szrj@item -mcode-density
89*a9fa9459SzrjThis option turns on Code Density instructions.  Only valid for ARC EM
90*a9fa9459Szrjprocessors.
91*a9fa9459Szrj
92*a9fa9459Szrj@cindex @code{-mrelax} command line option, ARC
93*a9fa9459Szrj@item -mrelax
94*a9fa9459SzrjEnable support for assembly-time relaxation.  The assembler will
95*a9fa9459Szrjreplace a longer version of an instruction with a shorter one,
96*a9fa9459Szrjwhenever it is possible.
97*a9fa9459Szrj
98*a9fa9459Szrj@cindex @code{-mnps400} command line option, ARC
99*a9fa9459Szrj@item -mnps400
100*a9fa9459SzrjEnable support for NPS-400 extended instructions.
101*a9fa9459Szrj
102*a9fa9459Szrj@cindex @code{-mspfp} command line option, ARC
103*a9fa9459Szrj@item -mspfp
104*a9fa9459SzrjEnable support for single-precision floating point instructions.
105*a9fa9459Szrj
106*a9fa9459Szrj@cindex @code{-mdpfp} command line option, ARC
107*a9fa9459Szrj@item -mdpfp
108*a9fa9459SzrjEnable support for double-precision floating point instructions.
109*a9fa9459Szrj
110*a9fa9459Szrj@cindex @code{-mfpuda} command line option, ARC
111*a9fa9459Szrj@item -mfpuda
112*a9fa9459SzrjEnable support for double-precision assist floating point instructions.
113*a9fa9459SzrjOnly valid for ARC EM processors.
114*a9fa9459Szrj
115*a9fa9459Szrj@end table
116*a9fa9459Szrj
117*a9fa9459Szrj@node ARC Syntax
118*a9fa9459Szrj@section Syntax
119*a9fa9459Szrj@menu
120*a9fa9459Szrj* ARC-Chars::                Special Characters
121*a9fa9459Szrj* ARC-Regs::                 Register Names
122*a9fa9459Szrj@end menu
123*a9fa9459Szrj
124*a9fa9459Szrj@node ARC-Chars
125*a9fa9459Szrj@subsection Special Characters
126*a9fa9459Szrj
127*a9fa9459Szrj@table @code
128*a9fa9459Szrj@item %
129*a9fa9459Szrj@cindex register name prefix character, ARC
130*a9fa9459Szrj@cindex ARC register name prefix character
131*a9fa9459SzrjA register name can optionally be prefixed by a @samp{%} character.  So
132*a9fa9459Szrjregister @code{%r0} is equivalent to @code{r0} in the assembly code.
133*a9fa9459Szrj
134*a9fa9459Szrj@item #
135*a9fa9459Szrj@cindex line comment character, ARC
136*a9fa9459Szrj@cindex ARC line comment character
137*a9fa9459SzrjThe presence of a @samp{#} character within a line (but not at the
138*a9fa9459Szrjstart of a line) indicates the start of a comment that extends to the
139*a9fa9459Szrjend of the current line.
140*a9fa9459Szrj
141*a9fa9459Szrj@emph{Note:} if a line starts with a @samp{#} character then it can
142*a9fa9459Szrjalso be a logical line number directive (@pxref{Comments}) or a
143*a9fa9459Szrjpreprocessor control command (@pxref{Preprocessing}).
144*a9fa9459Szrj
145*a9fa9459Szrj@item @@
146*a9fa9459Szrj@cindex symbol prefix character, ARC
147*a9fa9459Szrj@cindex ARC symbol prefix character
148*a9fa9459SzrjPrefixing an operand with an @samp{@@} specifies that the operand is a
149*a9fa9459Szrjsymbol and not a register.  This is how the assembler disambiguates
150*a9fa9459Szrjthe use of an ARC register name as a symbol.  So the instruction
151*a9fa9459Szrj@example
152*a9fa9459Szrjmov r0, @@r0
153*a9fa9459Szrj@end example
154*a9fa9459Szrjmoves the address of symbol @code{r0} into register @code{r0}.
155*a9fa9459Szrj
156*a9fa9459Szrj@item `
157*a9fa9459Szrj@cindex line separator, ARC
158*a9fa9459Szrj@cindex statement separator, ARC
159*a9fa9459Szrj@cindex ARC line separator
160*a9fa9459SzrjThe @samp{`} (backtick) character is used to separate statements on a
161*a9fa9459Szrjsingle line.
162*a9fa9459Szrj
163*a9fa9459Szrj@cindex line
164*a9fa9459Szrj@item -
165*a9fa9459Szrj@cindex C preprocessor macro separator, ARC
166*a9fa9459Szrj@cindex ARC C preprocessor macro separator
167*a9fa9459SzrjUsed as a separator to obtain a sequence of commands from a C
168*a9fa9459Szrjpreprocessor macro.
169*a9fa9459Szrj
170*a9fa9459Szrj@end table
171*a9fa9459Szrj
172*a9fa9459Szrj@node ARC-Regs
173*a9fa9459Szrj@subsection Register Names
174*a9fa9459Szrj
175*a9fa9459Szrj@cindex ARC register names
176*a9fa9459Szrj@cindex register names, ARC
177*a9fa9459SzrjThe ARC assembler uses the following register names for its core
178*a9fa9459Szrjregisters:
179*a9fa9459Szrj
180*a9fa9459Szrj@table @code
181*a9fa9459Szrj@item r0-r31
182*a9fa9459Szrj@cindex core general registers, ARC
183*a9fa9459Szrj@cindex ARC core general registers
184*a9fa9459SzrjThe core general registers.  Registers @code{r26} through @code{r31}
185*a9fa9459Szrjhave special functions, and are usually referred to by those synonyms.
186*a9fa9459Szrj
187*a9fa9459Szrj@item gp
188*a9fa9459Szrj@cindex global pointer, ARC
189*a9fa9459Szrj@cindex ARC global pointer
190*a9fa9459SzrjThe global pointer and a synonym for @code{r26}.
191*a9fa9459Szrj
192*a9fa9459Szrj@item fp
193*a9fa9459Szrj@cindex frame pointer, ARC
194*a9fa9459Szrj@cindex ARC frame pointer
195*a9fa9459SzrjThe frame pointer and a synonym for @code{r27}.
196*a9fa9459Szrj
197*a9fa9459Szrj@item sp
198*a9fa9459Szrj@cindex stack pointer, ARC
199*a9fa9459Szrj@cindex ARC stack pointer
200*a9fa9459SzrjThe stack pointer and a synonym for @code{r28}.
201*a9fa9459Szrj
202*a9fa9459Szrj@item ilink1
203*a9fa9459Szrj@cindex level 1 interrupt link register, ARC
204*a9fa9459Szrj@cindex ARC level 1 interrupt link register
205*a9fa9459SzrjFor ARC 600 and ARC 700, the level 1 interrupt link register and a
206*a9fa9459Szrjsynonym for @code{r29}.  Not supported for ARCv2.
207*a9fa9459Szrj
208*a9fa9459Szrj@item ilink
209*a9fa9459Szrj@cindex interrupt link register, ARC
210*a9fa9459Szrj@cindex ARC interrupt link register
211*a9fa9459SzrjFor ARCv2, the interrupt link register and a synonym for @code{r29}.
212*a9fa9459SzrjNot supported for ARC 600 and ARC 700.
213*a9fa9459Szrj
214*a9fa9459Szrj@item ilink2
215*a9fa9459Szrj@cindex level 2 interrupt link register, ARC
216*a9fa9459Szrj@cindex ARC level 2 interrupt link register
217*a9fa9459SzrjFor ARC 600 and ARC 700, the level 2 interrupt link register and a
218*a9fa9459Szrjsynonym for @code{r30}.  Not supported for ARC v2.
219*a9fa9459Szrj
220*a9fa9459Szrj@item blink
221*a9fa9459Szrj@cindex link register, ARC
222*a9fa9459Szrj@cindex ARC link register
223*a9fa9459SzrjThe link register and a synonym for @code{r31}.
224*a9fa9459Szrj
225*a9fa9459Szrj@item r32-r59
226*a9fa9459Szrj@cindex extension core registers, ARC
227*a9fa9459Szrj@cindex ARC extension core registers
228*a9fa9459SzrjThe extension core registers.
229*a9fa9459Szrj
230*a9fa9459Szrj@item lp_count
231*a9fa9459Szrj@cindex loop counter, ARC
232*a9fa9459Szrj@cindex ARC loop counter
233*a9fa9459SzrjThe loop count register.
234*a9fa9459Szrj
235*a9fa9459Szrj@item pcl
236*a9fa9459Szrj@cindex word aligned program counter, ARC
237*a9fa9459Szrj@cindex ARC word aligned program counter
238*a9fa9459SzrjThe word aligned program counter.
239*a9fa9459Szrj
240*a9fa9459Szrj@end table
241*a9fa9459Szrj
242*a9fa9459SzrjIn addition the ARC processor has a large number of @emph{auxiliary
243*a9fa9459Szrjregisters}.  The precise set depends on the extensions being
244*a9fa9459Szrjsupported, but the following baseline set are always defined:
245*a9fa9459Szrj
246*a9fa9459Szrj@table @code
247*a9fa9459Szrj@item identity
248*a9fa9459Szrj@cindex Processor Identification register, ARC
249*a9fa9459Szrj@cindex ARC Processor Identification register
250*a9fa9459SzrjProcessor Identification register.  Auxiliary register address 0x4.
251*a9fa9459Szrj
252*a9fa9459Szrj@item pc
253*a9fa9459Szrj@cindex Program Counter, ARC
254*a9fa9459Szrj@cindex ARC Program Counter
255*a9fa9459SzrjProgram Counter.  Auxiliary register address 0x6.
256*a9fa9459Szrj
257*a9fa9459Szrj@item status32
258*a9fa9459Szrj@cindex Status register, ARC
259*a9fa9459Szrj@cindex ARC Status register
260*a9fa9459SzrjStatus register.  Auxiliary register address 0x0a.
261*a9fa9459Szrj
262*a9fa9459Szrj@item bta
263*a9fa9459Szrj@cindex Branch Target Address, ARC
264*a9fa9459Szrj@cindex ARC Branch Target Address
265*a9fa9459SzrjBranch Target Address.  Auxiliary register address 0x412.
266*a9fa9459Szrj
267*a9fa9459Szrj@item ecr
268*a9fa9459Szrj@cindex Exception Cause Register, ARC
269*a9fa9459Szrj@cindex ARC Exception Cause Register
270*a9fa9459SzrjException Cause Register.  Auxiliary register address 0x403.
271*a9fa9459Szrj
272*a9fa9459Szrj@item int_vector_base
273*a9fa9459Szrj@cindex Interrupt Vector Base address, ARC
274*a9fa9459Szrj@cindex ARC Interrupt Vector Base address
275*a9fa9459SzrjInterrupt Vector Base address.  Auxiliary register address 0x25.
276*a9fa9459Szrj
277*a9fa9459Szrj@item status32_p0
278*a9fa9459Szrj@cindex Stored STATUS32 register on entry to level P0 interrupts, ARC
279*a9fa9459Szrj@cindex ARC Stored STATUS32 register on entry to level P0 interrupts
280*a9fa9459SzrjStored STATUS32 register on entry to level P0 interrupts.  Auxiliary
281*a9fa9459Szrjregister address 0xb.
282*a9fa9459Szrj
283*a9fa9459Szrj@item aux_user_sp
284*a9fa9459Szrj@cindex Saved User Stack Pointer, ARC
285*a9fa9459Szrj@cindex ARC Saved User Stack Pointer
286*a9fa9459SzrjSaved User Stack Pointer.  Auxiliary register address 0xd.
287*a9fa9459Szrj
288*a9fa9459Szrj@item eret
289*a9fa9459Szrj@cindex Exception Return Address, ARC
290*a9fa9459Szrj@cindex ARC Exception Return Address
291*a9fa9459SzrjException Return Address.  Auxiliary register address 0x400.
292*a9fa9459Szrj
293*a9fa9459Szrj@item erbta
294*a9fa9459Szrj@cindex BTA saved on exception entry, ARC
295*a9fa9459Szrj@cindex ARC BTA saved on exception entry
296*a9fa9459SzrjBTA saved on exception entry.  Auxiliary register address 0x401.
297*a9fa9459Szrj
298*a9fa9459Szrj@item erstatus
299*a9fa9459Szrj@cindex STATUS32 saved on exception, ARC
300*a9fa9459Szrj@cindex ARC STATUS32 saved on exception
301*a9fa9459SzrjSTATUS32 saved on exception.  Auxiliary register address 0x402.
302*a9fa9459Szrj
303*a9fa9459Szrj@item bcr_ver
304*a9fa9459Szrj@cindex Build Configuration Registers Version, ARC
305*a9fa9459Szrj@cindex ARC Build Configuration Registers Version
306*a9fa9459SzrjBuild Configuration Registers Version.  Auxiliary register address 0x60.
307*a9fa9459Szrj
308*a9fa9459Szrj@item bta_link_build
309*a9fa9459Szrj@cindex Build configuration for: BTA Registers, ARC
310*a9fa9459Szrj@cindex ARC Build configuration for: BTA Registers
311*a9fa9459SzrjBuild configuration for: BTA Registers.  Auxiliary register address 0x63.
312*a9fa9459Szrj
313*a9fa9459Szrj@item vecbase_ac_build
314*a9fa9459Szrj@cindex Build configuration for: Interrupts, ARC
315*a9fa9459Szrj@cindex ARC Build configuration for: Interrupts
316*a9fa9459SzrjBuild configuration for: Interrupts.  Auxiliary register address 0x68.
317*a9fa9459Szrj
318*a9fa9459Szrj@item rf_build
319*a9fa9459Szrj@cindex Build configuration for: Core Registers, ARC
320*a9fa9459Szrj@cindex ARC Build configuration for: Core Registers
321*a9fa9459SzrjBuild configuration for: Core Registers.  Auxiliary register address 0x6e.
322*a9fa9459Szrj
323*a9fa9459Szrj@item dccm_build
324*a9fa9459Szrj@cindex DCCM RAM Configuration Register, ARC
325*a9fa9459Szrj@cindex ARC DCCM RAM Configuration Register
326*a9fa9459SzrjDCCM RAM Configuration Register.  Auxiliary register address 0xc1.
327*a9fa9459Szrj
328*a9fa9459Szrj@end table
329*a9fa9459Szrj
330*a9fa9459SzrjAdditional auxiliary register names are defined according to the
331*a9fa9459Szrjprocessor architecture version and extensions selected by the options.
332*a9fa9459Szrj
333*a9fa9459Szrj@node ARC Directives
334*a9fa9459Szrj@section ARC Machine Directives
335*a9fa9459Szrj
336*a9fa9459Szrj@cindex machine directives, ARC
337*a9fa9459Szrj@cindex ARC machine directives
338*a9fa9459SzrjThe ARC version of @code{@value{AS}} supports the following additional
339*a9fa9459Szrjmachine directives:
340*a9fa9459Szrj
341*a9fa9459Szrj@table @code
342*a9fa9459Szrj
343*a9fa9459Szrj@cindex @code{lcomm} directive
344*a9fa9459Szrj@item .lcomm @var{symbol}, @var{length}[, @var{alignment}]
345*a9fa9459SzrjReserve @var{length} (an absolute expression) bytes for a local common
346*a9fa9459Szrjdenoted by @var{symbol}.  The section and value of @var{symbol} are
347*a9fa9459Szrjthose of the new local common.  The addresses are allocated in the bss
348*a9fa9459Szrjsection, so that at run-time the bytes start off zeroed.  Since
349*a9fa9459Szrj@var{symbol} is not declared global, it is normally not visible to
350*a9fa9459Szrj@code{@value{LD}}.  The optional third parameter, @var{alignment},
351*a9fa9459Szrjspecifies the desired alignment of the symbol in the bss section,
352*a9fa9459Szrjspecified as a byte boundary (for example, an alignment of 16 means
353*a9fa9459Szrjthat the least significant 4 bits of the address should be zero).  The
354*a9fa9459Szrjalignment must be an absolute expression, and it must be a power of
355*a9fa9459Szrjtwo.  If no alignment is specified, as will set the alignment to the
356*a9fa9459Szrjlargest power of two less than or equal to the size of the symbol, up
357*a9fa9459Szrjto a maximum of 16.
358*a9fa9459Szrj
359*a9fa9459Szrj@cindex @code{lcommon} directive, ARC
360*a9fa9459Szrj@item .lcommon @var{symbol}, @var{length}[, @var{alignment}]
361*a9fa9459SzrjThe same as @code{lcomm} directive.
362*a9fa9459Szrj
363*a9fa9459Szrj@cindex @code{cpu} directive, ARC
364*a9fa9459Szrj@item .cpu @var{cpu}
365*a9fa9459SzrjThe @code{.cpu} directive must be followed by the desired core
366*a9fa9459Szrjversion.  Permitted values for CPU are:
367*a9fa9459Szrj@table @code
368*a9fa9459Szrj@item ARC600
369*a9fa9459SzrjAssemble for the ARC600 instruction set.
370*a9fa9459Szrj
371*a9fa9459Szrj@item ARC700
372*a9fa9459SzrjAssemble for the ARC700 instruction set.
373*a9fa9459Szrj
374*a9fa9459Szrj@item NPS400
375*a9fa9459SzrjAssemble for the NPS400 instruction set.
376*a9fa9459Szrj
377*a9fa9459Szrj@item EM
378*a9fa9459SzrjAssemble for the ARC EM instruction set.
379*a9fa9459Szrj
380*a9fa9459Szrj@item HS
381*a9fa9459SzrjAssemble for the ARC HS instruction set.
382*a9fa9459Szrj
383*a9fa9459Szrj@end table
384*a9fa9459Szrj
385*a9fa9459SzrjNote: the @code{.cpu} directive overrides the command line option
386*a9fa9459Szrj@code{-mcpu=@var{cpu}}; a warning is emitted when the version is not
387*a9fa9459Szrjconsistent between the two.
388*a9fa9459Szrj
389*a9fa9459Szrj@item .extAuxRegister @var{name}, @var{addr}, @var{mode}
390*a9fa9459Szrj@cindex @code{extAuxRegister} directive, ARC
391*a9fa9459SzrjAuxiliary registers can be defined in the assembler source code by
392*a9fa9459Szrjusing this directive.  The first parameter, @var{name}, is the name of the
393*a9fa9459Szrjnew auxiliary register.  The second parameter, @var{addr}, is
394*a9fa9459Szrjaddress the of the auxiliary register.  The third parameter,
395*a9fa9459Szrj@var{mode}, specifies whether the register is readable and/or writable
396*a9fa9459Szrjand is one of:
397*a9fa9459Szrj@table @code
398*a9fa9459Szrj@item r
399*a9fa9459SzrjRead only;
400*a9fa9459Szrj
401*a9fa9459Szrj@item w
402*a9fa9459SzrjWrite only;
403*a9fa9459Szrj
404*a9fa9459Szrj@item r|w
405*a9fa9459SzrjRead and write.
406*a9fa9459Szrj
407*a9fa9459Szrj@end table
408*a9fa9459Szrj
409*a9fa9459SzrjFor example:
410*a9fa9459Szrj@example
411*a9fa9459Szrj	.extAuxRegister mulhi, 0x12, w
412*a9fa9459Szrj@end example
413*a9fa9459Szrjspecifies a write only extension auxiliary register, @var{mulhi} at
414*a9fa9459Szrjaddress 0x12.
415*a9fa9459Szrj
416*a9fa9459Szrj@item .extCondCode @var{suffix}, @var{val}
417*a9fa9459Szrj@cindex @code{extCondCode} directive, ARC
418*a9fa9459SzrjARC supports extensible condition codes.  This directive defines a new
419*a9fa9459Szrjcondition code, to be known by the suffix, @var{suffix} and will
420*a9fa9459Szrjdepend on the value, @var{val} in the condition code.
421*a9fa9459Szrj
422*a9fa9459SzrjFor example:
423*a9fa9459Szrj@example
424*a9fa9459Szrj	.extCondCode is_busy,0x14
425*a9fa9459Szrj	add.is_busy  r1,r2,r3
426*a9fa9459Szrj@end example
427*a9fa9459Szrjwill only execute the @code{add} instruction if the condition code
428*a9fa9459Szrjvalue is 0x14.
429*a9fa9459Szrj
430*a9fa9459Szrj@item .extCoreRegister @var{name}, @var{regnum}, @var{mode}, @var{shortcut}
431*a9fa9459Szrj@cindex @code{extCoreRegister} directive, ARC
432*a9fa9459SzrjSpecifies an extension core register named @var{name} as a synonym for
433*a9fa9459Szrjthe register numbered @var{regnum}.  The register number must be
434*a9fa9459Szrjbetween 32 and 59.  The third argument, @var{mode}, indicates whether
435*a9fa9459Szrjthe register is readable and/or writable and is one of:
436*a9fa9459Szrj@table @code
437*a9fa9459Szrj@item r
438*a9fa9459SzrjRead only;
439*a9fa9459Szrj
440*a9fa9459Szrj@item w
441*a9fa9459SzrjWrite only;
442*a9fa9459Szrj
443*a9fa9459Szrj@item r|w
444*a9fa9459SzrjRead and write.
445*a9fa9459Szrj
446*a9fa9459Szrj@end table
447*a9fa9459Szrj
448*a9fa9459SzrjThe final parameter, @var{shortcut} indicates whether the register has
449*a9fa9459Szrja short cut in the pipeline.  The valid values are:
450*a9fa9459Szrj@table @code
451*a9fa9459Szrj@item can_shortcut
452*a9fa9459SzrjThe register has a short cut in the pipeline;
453*a9fa9459Szrj
454*a9fa9459Szrj@item cannot_shortcut
455*a9fa9459SzrjThe register does not have a short cut in the pipeline.
456*a9fa9459Szrj@end table
457*a9fa9459Szrj
458*a9fa9459SzrjFor example:
459*a9fa9459Szrj@example
460*a9fa9459Szrj	.extCoreRegister mlo, 57, r , can_shortcut
461*a9fa9459Szrj@end example
462*a9fa9459Szrjdefines a read only extension core register, @code{mlo}, which is
463*a9fa9459Szrjregister 57, and can short cut the pipeline.
464*a9fa9459Szrj
465*a9fa9459Szrj@item .extInstruction @var{name}, @var{opcode}, @var{subopcode}, @var{suffixclass}, @var{syntaxclass}
466*a9fa9459Szrj@cindex @code{extInstruction} directive, ARC
467*a9fa9459SzrjARC allows the user to specify extension instructions.  These
468*a9fa9459Szrjextension instructions are not macros; the assembler creates encodings
469*a9fa9459Szrjfor use of these instructions according to the specification by the
470*a9fa9459Szrjuser.
471*a9fa9459Szrj
472*a9fa9459SzrjThe first argument, @var{name}, gives the name of the instruction.
473*a9fa9459Szrj
474*a9fa9459SzrjThe second argument, @var{opcode}, is the opcode to be used (bits 31:27
475*a9fa9459Szrjin the encoding).
476*a9fa9459Szrj
477*a9fa9459SzrjThe third argument, @var{subopcode}, is the sub-opcode to be used, but
478*a9fa9459Szrjthe correct value also depends on the fifth argument,
479*a9fa9459Szrj@var{syntaxclass}
480*a9fa9459Szrj
481*a9fa9459SzrjThe fourth argument, @var{suffixclass}, determines the kinds of
482*a9fa9459Szrjsuffixes to be allowed.  Valid values are:
483*a9fa9459Szrj@table @code
484*a9fa9459Szrj@item SUFFIX_NONE
485*a9fa9459SzrjNo suffixes are permitted;
486*a9fa9459Szrj
487*a9fa9459Szrj@item SUFFIX_COND
488*a9fa9459SzrjConditional suffixes are permitted;
489*a9fa9459Szrj
490*a9fa9459Szrj@item SUFFIX_FLAG
491*a9fa9459SzrjFlag setting suffixes are permitted.
492*a9fa9459Szrj
493*a9fa9459Szrj@item SUFFIX_COND|SUFFIX_FLAG
494*a9fa9459SzrjBoth conditional and flag setting suffices are permitted.
495*a9fa9459Szrj
496*a9fa9459Szrj@end table
497*a9fa9459Szrj
498*a9fa9459SzrjThe fifth and final argument, @var{syntaxclass}, determines the syntax
499*a9fa9459Szrjclass for the instruction.  It can have the following values:
500*a9fa9459Szrj@table @code
501*a9fa9459Szrj@item SYNTAX_2OP
502*a9fa9459SzrjTwo Operand Instruction;
503*a9fa9459Szrj
504*a9fa9459Szrj@item SYNTAX_3OP
505*a9fa9459SzrjThree Operand Instruction.
506*a9fa9459Szrj
507*a9fa9459Szrj@item SYNTAX_1OP
508*a9fa9459SzrjOne Operand Instruction.
509*a9fa9459Szrj
510*a9fa9459Szrj@item SYNTAX_NOP
511*a9fa9459SzrjNo Operand Instruction.
512*a9fa9459Szrj@end table
513*a9fa9459Szrj
514*a9fa9459SzrjThe syntax class may be followed by @samp{|} and one of the following
515*a9fa9459Szrjmodifiers.
516*a9fa9459Szrj@table @code
517*a9fa9459Szrj
518*a9fa9459Szrj@item OP1_MUST_BE_IMM
519*a9fa9459SzrjModifies syntax class @code{SYNTAX_3OP}, specifying that the first
520*a9fa9459Szrjoperand of a three-operand instruction must be an immediate (i.e., the
521*a9fa9459Szrjresult is discarded).  This is usually used to set the flags using
522*a9fa9459Szrjspecific instructions and not retain results.
523*a9fa9459Szrj
524*a9fa9459Szrj@item OP1_IMM_IMPLIED
525*a9fa9459SzrjModifies syntax class @code{SYNTAX_20P}, specifying that there is an
526*a9fa9459Szrjimplied immediate destination operand which does not appear in the
527*a9fa9459Szrjsyntax.
528*a9fa9459Szrj
529*a9fa9459SzrjFor example, if the source code contains an instruction like:
530*a9fa9459Szrj@example
531*a9fa9459Szrjinst r1,r2
532*a9fa9459Szrj@end example
533*a9fa9459Szrjthe first argument is an implied immediate (that is, the result is
534*a9fa9459Szrjdiscarded).  This is the same as though the source code were: inst
535*a9fa9459Szrj0,r1,r2.
536*a9fa9459Szrj
537*a9fa9459Szrj@end table
538*a9fa9459Szrj
539*a9fa9459SzrjFor example, defining a 64-bit multiplier with immediate operands:
540*a9fa9459Szrj@example
541*a9fa9459Szrj	.extInstruction  mp64, 0x07, 0x2d, SUFFIX_COND|SUFFIX_FLAG,
542*a9fa9459Szrj			 SYNTAX_3OP|OP1_MUST_BE_IMM
543*a9fa9459Szrj@end example
544*a9fa9459Szrjwhich specifies an extension instruction named @code{mp64} with 3
545*a9fa9459Szrjoperands.  It sets the flags and can be used with a condition code,
546*a9fa9459Szrjfor which the first operand is an immediate, i.e. equivalent to
547*a9fa9459Szrjdiscarding the result of the operation.
548*a9fa9459Szrj
549*a9fa9459SzrjA two operands instruction variant would be:
550*a9fa9459Szrj@example
551*a9fa9459Szrj	.extInstruction mul64, 0x07, 0x2d, SUFFIX_COND,
552*a9fa9459Szrj	SYNTAX_2OP|OP1_IMM_IMPLIED
553*a9fa9459Szrj@end example
554*a9fa9459Szrjwhich describes a two operand instruction with an implicit first
555*a9fa9459Szrjimmediate operand.  The result of this operation would be discarded.
556*a9fa9459Szrj
557*a9fa9459Szrj@end table
558*a9fa9459Szrj
559*a9fa9459Szrj@node ARC Modifiers
560*a9fa9459Szrj@section ARC Assembler Modifiers
561*a9fa9459Szrj
562*a9fa9459SzrjThe following additional assembler modifiers have been added for
563*a9fa9459Szrjposition-independent code.  These modifiers are available only with
564*a9fa9459Szrjthe ARC 700 and above processors and generate relocation entries,
565*a9fa9459Szrjwhich are interpreted by the linker as follows:
566*a9fa9459Szrj
567*a9fa9459Szrj@table @code
568*a9fa9459Szrj@item @@pcl(@var{symbol})
569*a9fa9459Szrj@cindex @@pcl(@var{symbol}), ARC modifier
570*a9fa9459SzrjRelative distance of @var{symbol}'s from the current program counter
571*a9fa9459Szrjlocation.
572*a9fa9459Szrj
573*a9fa9459Szrj@item @@gotpc(@var{symbol})
574*a9fa9459Szrj@cindex @@gotpc(@var{symbol}), ARC modifier
575*a9fa9459SzrjRelative distance of @var{symbol}'s Global Offset Table entry from the
576*a9fa9459Szrjcurrent program counter location.
577*a9fa9459Szrj
578*a9fa9459Szrj@item @@gotoff(@var{symbol})
579*a9fa9459Szrj@cindex @@gotoff(@var{symbol}), ARC modifier
580*a9fa9459SzrjDistance of @var{symbol} from the base of the Global Offset Table.
581*a9fa9459Szrj
582*a9fa9459Szrj@item @@plt(@var{symbol})
583*a9fa9459Szrj@cindex @@plt(@var{symbol}), ARC modifier
584*a9fa9459SzrjDistance of @var{symbol}'s Procedure Linkage Table entry from the
585*a9fa9459Szrjcurrent program counter.  This is valid only with branch and link
586*a9fa9459Szrjinstructions and PC-relative calls.
587*a9fa9459Szrj
588*a9fa9459Szrj@item @@sda(@var{symbol})
589*a9fa9459Szrj@cindex @@sda(@var{symbol}), ARC modifier
590*a9fa9459SzrjRelative distance of @var{symbol} from the base of the Small Data
591*a9fa9459SzrjPointer.
592*a9fa9459Szrj
593*a9fa9459Szrj@end table
594*a9fa9459Szrj
595*a9fa9459Szrj@node ARC Symbols
596*a9fa9459Szrj@section ARC Pre-defined Symbols
597*a9fa9459Szrj
598*a9fa9459SzrjThe following assembler symbols will prove useful when developing
599*a9fa9459Szrjposition-independent code.  These symbols are available only with the
600*a9fa9459SzrjARC 700 and above processors.
601*a9fa9459Szrj
602*a9fa9459Szrj@table @code
603*a9fa9459Szrj@item __GLOBAL_OFFSET_TABLE__
604*a9fa9459Szrj@cindex __GLOBAL_OFFSET_TABLE__, ARC pre-defined symbol
605*a9fa9459SzrjSymbol referring to the base of the Global Offset Table.
606*a9fa9459Szrj
607*a9fa9459Szrj@item __DYNAMIC__
608*a9fa9459Szrj@cindex __DYNAMIC__, ARC pre-defined symbol
609*a9fa9459SzrjAn alias for the Global Offset Table
610*a9fa9459Szrj@code{Base__GLOBAL_OFFSET_TABLE__}.  It can be used only with
611*a9fa9459Szrj@code{@@gotpc} modifiers.
612*a9fa9459Szrj
613*a9fa9459Szrj@end table
614*a9fa9459Szrj
615*a9fa9459Szrj@node ARC Opcodes
616*a9fa9459Szrj@section Opcodes
617*a9fa9459Szrj
618*a9fa9459Szrj@cindex ARC opcodes
619*a9fa9459Szrj@cindex opcodes for ARC
620*a9fa9459Szrj
621*a9fa9459SzrjFor information on the ARC instruction set, see @cite{ARC Programmers
622*a9fa9459SzrjReference Manual}, available where you download the processor IP library.
623