xref: /dflybsd-src/contrib/binutils-2.27/gas/doc/c-nds32.texi (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj@c Copyright (C) 2013-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@c man end
5*a9fa9459Szrj
6*a9fa9459Szrj@ifset GENERIC
7*a9fa9459Szrj@page
8*a9fa9459Szrj@node NDS32-Dependent
9*a9fa9459Szrj@chapter NDS32 Dependent Features
10*a9fa9459Szrj@end ifset
11*a9fa9459Szrj@ifclear GENERIC
12*a9fa9459Szrj@node Machine Dependencies
13*a9fa9459Szrj@chapter NDS32 Dependent Features
14*a9fa9459Szrj@end ifclear
15*a9fa9459Szrj
16*a9fa9459Szrj@cindex NDS32 processor
17*a9fa9459SzrjThe NDS32 processors family includes high-performance and low-power 32-bit
18*a9fa9459Szrjprocessors for high-end to low-end.  @sc{gnu} @code{@value{AS}} for NDS32
19*a9fa9459Szrjarchitectures supports NDS32 ISA version 3.  For detail about NDS32
20*a9fa9459Szrjinstruction set, please see the AndeStar ISA User Manual which is availible
21*a9fa9459Szrjat http://www.andestech.com/en/index/index.htm
22*a9fa9459Szrj
23*a9fa9459Szrj@menu
24*a9fa9459Szrj* NDS32 Options::         Assembler options
25*a9fa9459Szrj* NDS32 Syntax::          High-level assembly macros
26*a9fa9459Szrj@end menu
27*a9fa9459Szrj
28*a9fa9459Szrj@node NDS32 Options
29*a9fa9459Szrj@section NDS32 Options
30*a9fa9459Szrj
31*a9fa9459Szrj@cindex NDS32 options
32*a9fa9459Szrj@cindex options for NDS32
33*a9fa9459SzrjThe NDS32 configurations of @sc{gnu} @code{@value{AS}} support these
34*a9fa9459Szrjspecial options:
35*a9fa9459Szrj
36*a9fa9459Szrj@c man begin OPTIONS
37*a9fa9459Szrj@table @code
38*a9fa9459Szrj
39*a9fa9459Szrj@item -O1
40*a9fa9459SzrjOptimize for performance.
41*a9fa9459Szrj
42*a9fa9459Szrj@item -Os
43*a9fa9459SzrjOptimize for space.
44*a9fa9459Szrj
45*a9fa9459Szrj@item -EL
46*a9fa9459SzrjProduce little endian data output.
47*a9fa9459Szrj
48*a9fa9459Szrj@item -EB
49*a9fa9459SzrjProduce little endian data output.
50*a9fa9459Szrj
51*a9fa9459Szrj@item -mpic
52*a9fa9459SzrjGenerate PIC.
53*a9fa9459Szrj
54*a9fa9459Szrj@item -mno-fp-as-gp-relax
55*a9fa9459SzrjSuppress fp-as-gp relaxation for this file.
56*a9fa9459Szrj
57*a9fa9459Szrj@item -mb2bb-relax
58*a9fa9459SzrjBack-to-back branch optimization.
59*a9fa9459Szrj
60*a9fa9459Szrj@item -mno-all-relax
61*a9fa9459SzrjSuppress all relaxation for this file.
62*a9fa9459Szrj
63*a9fa9459Szrj@item -march=<arch name>
64*a9fa9459SzrjAssemble for architecture <arch name> which could be v3, v3j, v3m, v3f,
65*a9fa9459Szrjv3s, v2, v2j, v2f, v2s.
66*a9fa9459Szrj
67*a9fa9459Szrj@item -mbaseline=<baseline>
68*a9fa9459SzrjAssemble for baseline <baseline> which could be v2, v3, v3m.
69*a9fa9459Szrj
70*a9fa9459Szrj@item -mfpu-freg=@var{FREG}
71*a9fa9459SzrjSpecify a FPU configuration.
72*a9fa9459Szrj@table @code
73*a9fa9459Szrj@item 0      8 SP /  4 DP registers
74*a9fa9459Szrj@item 1     16 SP /  8 DP registers
75*a9fa9459Szrj@item 2     32 SP / 16 DP registers
76*a9fa9459Szrj@item 3     32 SP / 32 DP registers
77*a9fa9459Szrj@end table
78*a9fa9459Szrj
79*a9fa9459Szrj@item -mabi=@var{abi}
80*a9fa9459SzrjSpecify a abi version <abi> could be v1, v2, v2fp, v2fpp.
81*a9fa9459Szrj
82*a9fa9459Szrj@item -m[no-]mac
83*a9fa9459SzrjEnable/Disable Multiply instructions support.
84*a9fa9459Szrj
85*a9fa9459Szrj@item -m[no-]div
86*a9fa9459SzrjEnable/Disable Divide instructions support.
87*a9fa9459Szrj
88*a9fa9459Szrj@item -m[no-]16bit-ext
89*a9fa9459SzrjEnable/Disable 16-bit extension
90*a9fa9459Szrj
91*a9fa9459Szrj@item -m[no-]dx-regs
92*a9fa9459SzrjEnable/Disable d0/d1 registers
93*a9fa9459Szrj
94*a9fa9459Szrj@item -m[no-]perf-ext
95*a9fa9459SzrjEnable/Disable Performance extension
96*a9fa9459Szrj
97*a9fa9459Szrj@item -m[no-]perf2-ext
98*a9fa9459SzrjEnable/Disable Performance extension 2
99*a9fa9459Szrj
100*a9fa9459Szrj@item -m[no-]string-ext
101*a9fa9459SzrjEnable/Disable String extension
102*a9fa9459Szrj
103*a9fa9459Szrj@item -m[no-]reduced-regs
104*a9fa9459SzrjEnable/Disable Reduced Register configuration (GPR16) option
105*a9fa9459Szrj
106*a9fa9459Szrj@item -m[no-]audio-isa-ext
107*a9fa9459SzrjEnable/Disable AUDIO ISA extension
108*a9fa9459Szrj
109*a9fa9459Szrj@item -m[no-]fpu-sp-ext
110*a9fa9459SzrjEnable/Disable FPU SP extension
111*a9fa9459Szrj
112*a9fa9459Szrj@item -m[no-]fpu-dp-ext
113*a9fa9459SzrjEnable/Disable FPU DP extension
114*a9fa9459Szrj
115*a9fa9459Szrj@item -m[no-]fpu-fma
116*a9fa9459SzrjEnable/Disable FPU fused-multiply-add instructions
117*a9fa9459Szrj
118*a9fa9459Szrj@item -mall-ext
119*a9fa9459SzrjTurn on all extensions and instructions support
120*a9fa9459Szrj@end table
121*a9fa9459Szrj@c man end
122*a9fa9459Szrj
123*a9fa9459Szrj@node NDS32 Syntax
124*a9fa9459Szrj@section Syntax
125*a9fa9459Szrj
126*a9fa9459Szrj@menu
127*a9fa9459Szrj* NDS32-Chars::                Special Characters
128*a9fa9459Szrj* NDS32-Regs::                 Register Names
129*a9fa9459Szrj* NDS32-Ops::                  Pseudo Instructions
130*a9fa9459Szrj@end menu
131*a9fa9459Szrj
132*a9fa9459Szrj@node NDS32-Chars
133*a9fa9459Szrj@subsection Special Characters
134*a9fa9459Szrj
135*a9fa9459SzrjUse @samp{#} at column 1 and @samp{!} anywhere in the line except inside
136*a9fa9459Szrjquotes.
137*a9fa9459Szrj
138*a9fa9459SzrjMultiple instructions in a line are allowed though not recommended and
139*a9fa9459Szrjshould be separated by @samp{;}.
140*a9fa9459Szrj
141*a9fa9459SzrjAssembler is not case-sensitive in general except user defined label.
142*a9fa9459SzrjFor example, @samp{jral F1} is different from @samp{jral f1} while it is
143*a9fa9459Szrjthe same as @samp{JRAL F1}.
144*a9fa9459Szrj
145*a9fa9459Szrj@node NDS32-Regs
146*a9fa9459Szrj@subsection Register Names
147*a9fa9459Szrj@table @code
148*a9fa9459Szrj@item General purpose registers (GPR)
149*a9fa9459SzrjThere are 32 32-bit general purpose registers $r0 to $r31.
150*a9fa9459Szrj
151*a9fa9459Szrj@item Accumulators d0 and d1
152*a9fa9459Szrj64-bit accumulators: $d0.hi, $d0.lo, $d1.hi, and $d1.lo.
153*a9fa9459Szrj
154*a9fa9459Szrj@item Assembler reserved register $ta
155*a9fa9459SzrjRegister $ta ($r15) is reserved for assembler using.
156*a9fa9459Szrj
157*a9fa9459Szrj@item Operating system reserved registers $p0 and $p1
158*a9fa9459SzrjRegisters $p0 ($r26) and $p1 ($r27) are used by operating system as scratch
159*a9fa9459Szrjregisters.
160*a9fa9459Szrj
161*a9fa9459Szrj@item Frame pointer $fp
162*a9fa9459SzrjRegister $r28 is regarded as the frame pointer.
163*a9fa9459Szrj
164*a9fa9459Szrj@item Global pointer
165*a9fa9459SzrjRegister $r29 is regarded as the global pointer.
166*a9fa9459Szrj
167*a9fa9459Szrj@item Link pointer
168*a9fa9459SzrjRegister $r30 is regarded as the link pointer.
169*a9fa9459Szrj
170*a9fa9459Szrj@item Stack pointer
171*a9fa9459SzrjRegister $r31 is regarded as the stack pointer.
172*a9fa9459Szrj@end table
173*a9fa9459Szrj
174*a9fa9459Szrj@node NDS32-Ops
175*a9fa9459Szrj@subsection Pseudo Instructions
176*a9fa9459Szrj@table @code
177*a9fa9459Szrj@item li rt5,imm32
178*a9fa9459Szrjload 32-bit integer into register rt5.  @samp{sethi rt5,hi20(imm32)} and then
179*a9fa9459Szrj@samp{ori rt5,reg,lo12(imm32)}.
180*a9fa9459Szrj
181*a9fa9459Szrj@item la rt5,var
182*a9fa9459SzrjLoad 32-bit address of var into register rt5.  @samp{sethi rt5,hi20(var)} and
183*a9fa9459Szrjthen @samp{ori reg,rt5,lo12(var)}
184*a9fa9459Szrj
185*a9fa9459Szrj@item l.[bhw] rt5,var
186*a9fa9459SzrjLoad value of var into register rt5.  @samp{sethi $ta,hi20(var)} and then
187*a9fa9459Szrj@samp{l[bhw]i rt5,[$ta+lo12(var)]}
188*a9fa9459Szrj
189*a9fa9459Szrj@item l.[bh]s rt5,var
190*a9fa9459SzrjLoad value of var into register rt5.  @samp{sethi $ta,hi20(var)} and then
191*a9fa9459Szrj@samp{l[bh]si rt5,[$ta+lo12(var)]}
192*a9fa9459Szrj
193*a9fa9459Szrj@item  l.[bhw]p rt5,var,inc
194*a9fa9459SzrjLoad value of var into register rt5 and increment $ta by amount inc.
195*a9fa9459Szrj@samp{la $ta,var} and then @samp{l[bhw]i.bi rt5,[$ta],inc}
196*a9fa9459Szrj
197*a9fa9459Szrj@item l.[bhw]pc rt5,inc
198*a9fa9459SzrjContinue loading value of var into register rt5 and increment $ta by amount inc.
199*a9fa9459Szrj@samp{l[bhw]i.bi rt5,[$ta],inc.}
200*a9fa9459Szrj
201*a9fa9459Szrj@item l.[bh]sp rt5,var,inc
202*a9fa9459SzrjLoad value of var into register rt5 and increment $ta by amount inc.
203*a9fa9459Szrj@samp{la $ta,var} and then @samp{l[bh]si.bi rt5,[$ta],inc}
204*a9fa9459Szrj
205*a9fa9459Szrj@item l.[bh]spc rt5,inc
206*a9fa9459SzrjContinue loading value of var into register rt5 and increment $ta by amount inc.
207*a9fa9459Szrj@samp{l[bh]si.bi rt5,[$ta],inc.}
208*a9fa9459Szrj
209*a9fa9459Szrj@item s.[bhw] rt5,var
210*a9fa9459SzrjStore register rt5 to var.
211*a9fa9459Szrj@samp{sethi $ta,hi20(var)} and then @samp{s[bhw]i rt5,[$ta+lo12(var)]}
212*a9fa9459Szrj
213*a9fa9459Szrj@item s.[bhw]p rt5,var,inc
214*a9fa9459SzrjStore register rt5 to var and increment $ta by amount inc.
215*a9fa9459Szrj@samp{la $ta,var} and then @samp{s[bhw]i.bi rt5,[$ta],inc}
216*a9fa9459Szrj
217*a9fa9459Szrj@item s.[bhw]pc rt5,inc
218*a9fa9459SzrjContinue storing register rt5 to var and increment $ta by amount inc.
219*a9fa9459Szrj@samp{s[bhw]i.bi rt5,[$ta],inc.}
220*a9fa9459Szrj
221*a9fa9459Szrj@item not rt5,ra5
222*a9fa9459SzrjAlias of @samp{nor rt5,ra5,ra5}.
223*a9fa9459Szrj
224*a9fa9459Szrj@item neg rt5,ra5
225*a9fa9459SzrjAlias of @samp{subri rt5,ra5,0}.
226*a9fa9459Szrj
227*a9fa9459Szrj@item br rb5
228*a9fa9459SzrjDepending on how it is assembled, it is translated into @samp{r5 rb5}
229*a9fa9459Szrjor @samp{jr rb5}.
230*a9fa9459Szrj
231*a9fa9459Szrj@item b label
232*a9fa9459SzrjBranch to label depending on how it is assembled, it is translated into
233*a9fa9459Szrj@samp{j8 label}, @samp{j label}, or "@samp{la $ta,label} @samp{br $ta}".
234*a9fa9459Szrj
235*a9fa9459Szrj@item bral rb5
236*a9fa9459SzrjAlias of jral br5 depending on how it is assembled, it is translated
237*a9fa9459Szrjinto @samp{jral5 rb5} or @samp{jral rb5}.
238*a9fa9459Szrj
239*a9fa9459Szrj@item bal fname
240*a9fa9459SzrjAlias of jal fname depending on how it is assembled, it is translated into
241*a9fa9459Szrj@samp{jal fname} or "@samp{la $ta,fname} @samp{bral $ta}".
242*a9fa9459Szrj
243*a9fa9459Szrj@item call fname
244*a9fa9459SzrjCall function fname same as @samp{jal fname}.
245*a9fa9459Szrj
246*a9fa9459Szrj@item move rt5,ra5
247*a9fa9459SzrjFor 16-bit, this is @samp{mov55 rt5,ra5}.
248*a9fa9459SzrjFor no 16-bit, this is @samp{ori rt5,ra5,0}.
249*a9fa9459Szrj
250*a9fa9459Szrj@item move rt5,var
251*a9fa9459SzrjThis is the same as @samp{l.w rt5,var}.
252*a9fa9459Szrj
253*a9fa9459Szrj@item move rt5,imm32
254*a9fa9459SzrjThis is the same as @samp{li rt5,imm32}.
255*a9fa9459Szrj
256*a9fa9459Szrj@item pushm ra5,rb5
257*a9fa9459SzrjPush contents of registers from ra5 to rb5 into stack.
258*a9fa9459Szrj
259*a9fa9459Szrj@item push ra5
260*a9fa9459SzrjPush content of register ra5 into stack. (same @samp{pushm ra5,ra5}).
261*a9fa9459Szrj
262*a9fa9459Szrj@item push.d var
263*a9fa9459SzrjPush value of double-word variable var into stack.
264*a9fa9459Szrj
265*a9fa9459Szrj@item push.w var
266*a9fa9459SzrjPush value of word variable var into stack.
267*a9fa9459Szrj
268*a9fa9459Szrj@item push.h var
269*a9fa9459SzrjPush value of half-word variable var into stack.
270*a9fa9459Szrj
271*a9fa9459Szrj@item push.b var
272*a9fa9459SzrjPush value of byte variable var into stack.
273*a9fa9459Szrj
274*a9fa9459Szrj@item pusha var
275*a9fa9459SzrjPush 32-bit address of variable var into stack.
276*a9fa9459Szrj
277*a9fa9459Szrj@item pushi imm32
278*a9fa9459SzrjPush 32-bit immediate value into stack.
279*a9fa9459Szrj
280*a9fa9459Szrj@item popm ra5,rb5
281*a9fa9459SzrjPop top of stack values into registers ra5 to rb5.
282*a9fa9459Szrj
283*a9fa9459Szrj@item pop rt5
284*a9fa9459SzrjPop top of stack value into register. (same as @samp{popm rt5,rt5}.)
285*a9fa9459Szrj
286*a9fa9459Szrj@item pop.d var,ra5
287*a9fa9459SzrjPop value of double-word variable var from stack using register ra5
288*a9fa9459Szrjas 2nd scratch register. (1st is $ta)
289*a9fa9459Szrj
290*a9fa9459Szrj@item pop.w var,ra5
291*a9fa9459SzrjPop value of word variable var from stack using register ra5.
292*a9fa9459Szrj
293*a9fa9459Szrj@item pop.h var,ra5
294*a9fa9459SzrjPop value of half-word variable var from stack using register ra5.
295*a9fa9459Szrj
296*a9fa9459Szrj@item pop.b var,ra5
297*a9fa9459SzrjPop value of byte variable var from stack using register ra5.
298*a9fa9459Szrj
299*a9fa9459Szrj@end table
300