xref: /openbsd-src/gnu/usr.bin/binutils-2.17/gas/doc/c-arc.texi (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod@c Copyright 2000, 2001, 2005 Free Software Foundation, Inc.
2*3d8817e4Smiod@c This is part of the GAS manual.
3*3d8817e4Smiod@c For copying conditions, see the file as.texinfo.
4*3d8817e4Smiod
5*3d8817e4Smiod@ifset GENERIC
6*3d8817e4Smiod@page
7*3d8817e4Smiod@node ARC-Dependent
8*3d8817e4Smiod@chapter ARC Dependent Features
9*3d8817e4Smiod@end ifset
10*3d8817e4Smiod
11*3d8817e4Smiod@ifclear GENERIC
12*3d8817e4Smiod@node Machine Dependencies
13*3d8817e4Smiod@chapter ARC Dependent Features
14*3d8817e4Smiod@end ifclear
15*3d8817e4Smiod
16*3d8817e4Smiod@set ARC_CORE_DEFAULT 6
17*3d8817e4Smiod
18*3d8817e4Smiod@cindex ARC support
19*3d8817e4Smiod@menu
20*3d8817e4Smiod* ARC Options::              Options
21*3d8817e4Smiod* ARC Syntax::               Syntax
22*3d8817e4Smiod* ARC Floating Point::       Floating Point
23*3d8817e4Smiod* ARC Directives::           ARC Machine Directives
24*3d8817e4Smiod* ARC Opcodes::              Opcodes
25*3d8817e4Smiod@end menu
26*3d8817e4Smiod
27*3d8817e4Smiod
28*3d8817e4Smiod@node ARC Options
29*3d8817e4Smiod@section Options
30*3d8817e4Smiod@cindex ARC options (none)
31*3d8817e4Smiod@cindex options for ARC (none)
32*3d8817e4Smiod
33*3d8817e4Smiod@table @code
34*3d8817e4Smiod
35*3d8817e4Smiod@cindex @code{-marc[5|6|7|8]} command line option, ARC
36*3d8817e4Smiod@item -marc[5|6|7|8]
37*3d8817e4SmiodThis option selects the core processor variant.  Using
38*3d8817e4Smiod@code{-marc} is the same as @code{-marc@value{ARC_CORE_DEFAULT}}, which
39*3d8817e4Smiodis also the default.
40*3d8817e4Smiod
41*3d8817e4Smiod@table @code
42*3d8817e4Smiod
43*3d8817e4Smiod@cindex @code{arc5} arc5, ARC
44*3d8817e4Smiod@item arc5
45*3d8817e4SmiodBase instruction set.
46*3d8817e4Smiod
47*3d8817e4Smiod@cindex @code{arc6} arc6, ARC
48*3d8817e4Smiod@item arc6
49*3d8817e4SmiodJump-and-link (jl) instruction.  No requirement of an instruction between
50*3d8817e4Smiodsetting flags and conditional jump.  For example:
51*3d8817e4Smiod
52*3d8817e4Smiod@smallexample
53*3d8817e4Smiod  mov.f r0,r1
54*3d8817e4Smiod  beq   foo
55*3d8817e4Smiod@end smallexample
56*3d8817e4Smiod
57*3d8817e4Smiod@cindex @code{arc7} arc7, ARC
58*3d8817e4Smiod@item arc7
59*3d8817e4SmiodBreak (brk) and sleep (sleep) instructions.
60*3d8817e4Smiod
61*3d8817e4Smiod@cindex @code{arc8} arc8, ARC
62*3d8817e4Smiod@item arc8
63*3d8817e4SmiodSoftware interrupt (swi) instruction.
64*3d8817e4Smiod
65*3d8817e4Smiod@end table
66*3d8817e4Smiod
67*3d8817e4SmiodNote: the @code{.option} directive can to be used to select a core
68*3d8817e4Smiodvariant from within assembly code.
69*3d8817e4Smiod
70*3d8817e4Smiod@cindex @code{-EB} command line option, ARC
71*3d8817e4Smiod@item -EB
72*3d8817e4SmiodThis option specifies that the output generated by the assembler should
73*3d8817e4Smiodbe marked as being encoded for a big-endian processor.
74*3d8817e4Smiod
75*3d8817e4Smiod@cindex @code{-EL} command line option, ARC
76*3d8817e4Smiod@item -EL
77*3d8817e4SmiodThis option specifies that the output generated by the assembler should
78*3d8817e4Smiodbe marked as being encoded for a little-endian processor - this is the
79*3d8817e4Smioddefault.
80*3d8817e4Smiod
81*3d8817e4Smiod@end table
82*3d8817e4Smiod
83*3d8817e4Smiod
84*3d8817e4Smiod@node ARC Syntax
85*3d8817e4Smiod@section Syntax
86*3d8817e4Smiod@menu
87*3d8817e4Smiod* ARC-Chars::                Special Characters
88*3d8817e4Smiod* ARC-Regs::                 Register Names
89*3d8817e4Smiod@end menu
90*3d8817e4Smiod
91*3d8817e4Smiod@node ARC-Chars
92*3d8817e4Smiod@subsection Special Characters
93*3d8817e4Smiod
94*3d8817e4Smiod@cindex ARC special characters
95*3d8817e4Smiod@cindex special characters, ARC
96*3d8817e4Smiod*TODO*
97*3d8817e4Smiod
98*3d8817e4Smiod@node ARC-Regs
99*3d8817e4Smiod@subsection Register Names
100*3d8817e4Smiod
101*3d8817e4Smiod@cindex ARC register names
102*3d8817e4Smiod@cindex register names, ARC
103*3d8817e4Smiod*TODO*
104*3d8817e4Smiod
105*3d8817e4Smiod
106*3d8817e4Smiod@node ARC Floating Point
107*3d8817e4Smiod@section Floating Point
108*3d8817e4Smiod
109*3d8817e4Smiod@cindex floating point, ARC (@sc{ieee})
110*3d8817e4Smiod@cindex ARC floating point (@sc{ieee})
111*3d8817e4SmiodThe ARC core does not currently have hardware floating point
112*3d8817e4Smiodsupport. Software floating point support is provided by @code{GCC}
113*3d8817e4Smiodand uses @sc{ieee} floating-point numbers.
114*3d8817e4Smiod
115*3d8817e4Smiod
116*3d8817e4Smiod@node ARC Directives
117*3d8817e4Smiod@section ARC Machine Directives
118*3d8817e4Smiod
119*3d8817e4Smiod@cindex machine directives, ARC
120*3d8817e4Smiod@cindex ARC machine directives
121*3d8817e4SmiodThe ARC version of @code{@value{AS}} supports the following additional
122*3d8817e4Smiodmachine directives:
123*3d8817e4Smiod
124*3d8817e4Smiod@table @code
125*3d8817e4Smiod
126*3d8817e4Smiod@cindex @code{2byte} directive, ARC
127*3d8817e4Smiod@item .2byte @var{expressions}
128*3d8817e4Smiod*TODO*
129*3d8817e4Smiod
130*3d8817e4Smiod@cindex @code{3byte} directive, ARC
131*3d8817e4Smiod@item .3byte @var{expressions}
132*3d8817e4Smiod*TODO*
133*3d8817e4Smiod
134*3d8817e4Smiod@cindex @code{4byte} directive, ARC
135*3d8817e4Smiod@item .4byte @var{expressions}
136*3d8817e4Smiod*TODO*
137*3d8817e4Smiod
138*3d8817e4Smiod@cindex @code{extAuxRegister} directive, ARC
139*3d8817e4Smiod@item .extAuxRegister @var{name},@var{address},@var{mode}
140*3d8817e4SmiodThe ARCtangent A4 has extensible auxiliary register space.  The
141*3d8817e4Smiodauxiliary registers can be defined in the assembler source code by
142*3d8817e4Smiodusing this directive.  The first parameter is the @var{name} of the
143*3d8817e4Smiodnew auxiallry register.  The second parameter is the @var{address} of
144*3d8817e4Smiodthe register in the auxiliary register memory map for the variant of
145*3d8817e4Smiodthe ARC.  The third parameter specifies the @var{mode} in which the
146*3d8817e4Smiodregister can be operated is and it can be one of:
147*3d8817e4Smiod
148*3d8817e4Smiod@table @code
149*3d8817e4Smiod@item r          (readonly)
150*3d8817e4Smiod@item w          (write only)
151*3d8817e4Smiod@item r|w        (read or write)
152*3d8817e4Smiod@end table
153*3d8817e4Smiod
154*3d8817e4SmiodFor example:
155*3d8817e4Smiod
156*3d8817e4Smiod@smallexample
157*3d8817e4Smiod  .extAuxRegister mulhi,0x12,w
158*3d8817e4Smiod@end smallexample
159*3d8817e4Smiod
160*3d8817e4SmiodThis specifies an extension auxiliary register called @emph{mulhi}
161*3d8817e4Smiodwhich is at address 0x12 in the memory space and which is only
162*3d8817e4Smiodwritable.
163*3d8817e4Smiod
164*3d8817e4Smiod@cindex @code{extCondCode} directive, ARC
165*3d8817e4Smiod@item .extCondCode @var{suffix},@var{value}
166*3d8817e4SmiodThe condition codes on the ARCtangent A4 are extensible and can be
167*3d8817e4Smiodspecified by means of this assembler directive.  They are specified
168*3d8817e4Smiodby the suffix and the value for the condition code.  They can be used to
169*3d8817e4Smiodspecify extra condition codes with any values.  For example:
170*3d8817e4Smiod
171*3d8817e4Smiod@smallexample
172*3d8817e4Smiod  .extCondCode is_busy,0x14
173*3d8817e4Smiod
174*3d8817e4Smiod   add.is_busy  r1,r2,r3
175*3d8817e4Smiod   bis_busy     _main
176*3d8817e4Smiod@end smallexample
177*3d8817e4Smiod
178*3d8817e4Smiod@cindex @code{extCoreRegister} directive, ARC
179*3d8817e4Smiod@item .extCoreRegister @var{name},@var{regnum},@var{mode},@var{shortcut}
180*3d8817e4SmiodSpecifies an extension core register @var{name} for the application.
181*3d8817e4SmiodThis allows a register @var{name} with a valid @var{regnum} between 0
182*3d8817e4Smiodand 60, with the following as valid values for @var{mode}
183*3d8817e4Smiod
184*3d8817e4Smiod@table @samp
185*3d8817e4Smiod@item @emph{r}   (readonly)
186*3d8817e4Smiod@item @emph{w}   (write only)
187*3d8817e4Smiod@item @emph{r|w} (read or write)
188*3d8817e4Smiod@end table
189*3d8817e4Smiod
190*3d8817e4Smiod
191*3d8817e4SmiodThe other parameter gives a description of the register having a
192*3d8817e4Smiod@var{shortcut} in the pipeline.  The valid values are:
193*3d8817e4Smiod
194*3d8817e4Smiod@table @code
195*3d8817e4Smiod@item can_shortcut
196*3d8817e4Smiod@item cannot_shortcut
197*3d8817e4Smiod@end table
198*3d8817e4Smiod
199*3d8817e4SmiodFor example:
200*3d8817e4Smiod
201*3d8817e4Smiod@smallexample
202*3d8817e4Smiod  .extCoreRegister mlo,57,r,can_shortcut
203*3d8817e4Smiod@end smallexample
204*3d8817e4Smiod
205*3d8817e4SmiodThis defines an extension core register mlo with the value 57 which
206*3d8817e4Smiodcan shortcut the pipeline.
207*3d8817e4Smiod
208*3d8817e4Smiod@cindex @code{extInstruction} directive, ARC
209*3d8817e4Smiod@item .extInstruction @var{name},@var{opcode},@var{subopcode},@var{suffixclass},@var{syntaxclass}
210*3d8817e4SmiodThe ARCtangent A4 allows the user to specify extension instructions.
211*3d8817e4SmiodThe extension instructions are not macros.  The assembler creates
212*3d8817e4Smiodencodings for use of these instructions according to the specification
213*3d8817e4Smiodby the user.  The parameters are:
214*3d8817e4Smiod
215*3d8817e4Smiod@table @bullet
216*3d8817e4Smiod@item @var{name}
217*3d8817e4SmiodName of the extension instruction
218*3d8817e4Smiod
219*3d8817e4Smiod@item @var{opcode}
220*3d8817e4SmiodOpcode to be used. (Bits 27:31 in the encoding).  Valid values
221*3d8817e4Smiod0x10-0x1f or 0x03
222*3d8817e4Smiod
223*3d8817e4Smiod@item @var{subopcode}
224*3d8817e4SmiodSubopcode to be used.  Valid values are from 0x09-0x3f.  However the
225*3d8817e4Smiodcorrect value also depends on @var{syntaxclass}
226*3d8817e4Smiod
227*3d8817e4Smiod@item @var{suffixclass}
228*3d8817e4SmiodDetermines the kinds of suffixes to be allowed.  Valid values are
229*3d8817e4Smiod@code{SUFFIX_NONE}, @code{SUFFIX_COND},
230*3d8817e4Smiod@code{SUFFIX_FLAG} which indicates the absence or presence of
231*3d8817e4Smiodconditional suffixes and flag setting by the extension instruction.
232*3d8817e4SmiodIt is also possible to specify that an instruction sets the flags and
233*3d8817e4Smiodis conditional by using @code{SUFFIX_CODE} | @code{SUFFIX_FLAG}.
234*3d8817e4Smiod
235*3d8817e4Smiod@item @var{syntaxclass}
236*3d8817e4SmiodDetermines the syntax class for the instruction.  It can have the
237*3d8817e4Smiodfollowing values:
238*3d8817e4Smiod
239*3d8817e4Smiod@table @code
240*3d8817e4Smiod@item @code{SYNTAX_2OP}:
241*3d8817e4Smiod2 Operand Instruction
242*3d8817e4Smiod@item @code{SYNTAX_3OP}:
243*3d8817e4Smiod3 Operand Instruction
244*3d8817e4Smiod@end table
245*3d8817e4Smiod
246*3d8817e4SmiodIn addition there could be modifiers for the syntax class as described
247*3d8817e4Smiodbelow:
248*3d8817e4Smiod
249*3d8817e4Smiod@itemize @minus
250*3d8817e4SmiodSyntax Class Modifiers are:
251*3d8817e4Smiod
252*3d8817e4Smiod@item @code{OP1_MUST_BE_IMM}:
253*3d8817e4SmiodModifies syntax class SYNTAX_3OP,  specifying that the first operand
254*3d8817e4Smiodof a three-operand instruction must be an immediate (i.e. the result
255*3d8817e4Smiodis discarded).  OP1_MUST_BE_IMM is used by bitwise ORing it with
256*3d8817e4SmiodSYNTAX_3OP as given in the example below.  This could usually be used
257*3d8817e4Smiodto set the flags using specific instructions and not retain results.
258*3d8817e4Smiod
259*3d8817e4Smiod@item @code{OP1_IMM_IMPLIED}:
260*3d8817e4SmiodModifies syntax class SYNTAX_20P, it specifies that there is an
261*3d8817e4Smiodimplied immediate destination operand which does not appear in the
262*3d8817e4Smiodsyntax.  For example, if the source code contains an instruction like:
263*3d8817e4Smiod
264*3d8817e4Smiod@smallexample
265*3d8817e4Smiodinst r1,r2
266*3d8817e4Smiod@end smallexample
267*3d8817e4Smiod
268*3d8817e4Smiodit really means that the first argument is an implied immediate (that
269*3d8817e4Smiodis, the result is discarded).  This is the same as though the source
270*3d8817e4Smiodcode were: inst 0,r1,r2.  You use OP1_IMM_IMPLIED by bitwise ORing it
271*3d8817e4Smiodwith SYNTAX_20P.
272*3d8817e4Smiod
273*3d8817e4Smiod@end itemize
274*3d8817e4Smiod@end table
275*3d8817e4Smiod
276*3d8817e4SmiodFor example, defining 64-bit multiplier with immediate operands:
277*3d8817e4Smiod
278*3d8817e4Smiod@smallexample
279*3d8817e4Smiod.extInstruction mp64,0x14,0x0,SUFFIX_COND | SUFFIX_FLAG ,
280*3d8817e4Smiod                SYNTAX_3OP|OP1_MUST_BE_IMM
281*3d8817e4Smiod@end smallexample
282*3d8817e4Smiod
283*3d8817e4SmiodThe above specifies an extension instruction called mp64 which has 3 operands,
284*3d8817e4Smiodsets the flags, can be used with a condition code, for which the
285*3d8817e4Smiodfirst operand is an immediate.  (Equivalent to discarding the result
286*3d8817e4Smiodof the operation).
287*3d8817e4Smiod
288*3d8817e4Smiod@smallexample
289*3d8817e4Smiod .extInstruction mul64,0x14,0x00,SUFFIX_COND, SYNTAX_2OP|OP1_IMM_IMPLIED
290*3d8817e4Smiod@end smallexample
291*3d8817e4Smiod
292*3d8817e4SmiodThis describes a 2 operand instruction with an implicit first
293*3d8817e4Smiodimmediate operand.  The result of this operation would be discarded.
294*3d8817e4Smiod
295*3d8817e4Smiod@cindex @code{half} directive, ARC
296*3d8817e4Smiod@item .half @var{expressions}
297*3d8817e4Smiod*TODO*
298*3d8817e4Smiod
299*3d8817e4Smiod@cindex @code{long} directive, ARC
300*3d8817e4Smiod@item .long @var{expressions}
301*3d8817e4Smiod*TODO*
302*3d8817e4Smiod
303*3d8817e4Smiod@cindex @code{option} directive, ARC
304*3d8817e4Smiod@item .option @var{arc|arc5|arc6|arc7|arc8}
305*3d8817e4SmiodThe @code{.option} directive must be followed by the desired core
306*3d8817e4Smiodversion. Again @code{arc} is an alias for
307*3d8817e4Smiod@code{arc@value{ARC_CORE_DEFAULT}}.
308*3d8817e4Smiod
309*3d8817e4SmiodNote: the @code{.option} directive overrides the command line option
310*3d8817e4Smiod@code{-marc}; a warning is emitted when the version is not consistent
311*3d8817e4Smiodbetween the two - even for the implicit default core version
312*3d8817e4Smiod(arc@value{ARC_CORE_DEFAULT}).
313*3d8817e4Smiod
314*3d8817e4Smiod@cindex @code{short} directive, ARC
315*3d8817e4Smiod@item .short @var{expressions}
316*3d8817e4Smiod*TODO*
317*3d8817e4Smiod
318*3d8817e4Smiod@cindex @code{word} directive, ARC
319*3d8817e4Smiod@item .word @var{expressions}
320*3d8817e4Smiod*TODO*
321*3d8817e4Smiod
322*3d8817e4Smiod@end table
323*3d8817e4Smiod
324*3d8817e4Smiod
325*3d8817e4Smiod@node ARC Opcodes
326*3d8817e4Smiod@section Opcodes
327*3d8817e4Smiod
328*3d8817e4Smiod@cindex ARC opcodes
329*3d8817e4Smiod@cindex opcodes for ARC
330*3d8817e4Smiod
331*3d8817e4SmiodFor information on the ARC instruction set, see @cite{ARC Programmers
332*3d8817e4SmiodReference Manual}, ARC International (www.arc.com)
333*3d8817e4Smiod
334