1 @c Copyright (C) 2013-2019 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
9 @chapter NDS32 Dependent Features
12 @node Machine Dependencies
13 @chapter NDS32 Dependent Features
16 @cindex NDS32 processor
17 The NDS32 processors family includes high-performance and low-power 32-bit
18 processors for high-end to low-end. @sc{gnu} @code{@value{AS}} for NDS32
19 architectures supports NDS32 ISA version 3. For detail about NDS32
20 instruction set, please see the AndeStar ISA User Manual which is available
21 at http://www.andestech.com/en/index/index.htm
24 * NDS32 Options:: Assembler options
25 * NDS32 Syntax:: High-level assembly macros
29 @section NDS32 Options
32 @cindex options for NDS32
33 The NDS32 configurations of @sc{gnu} @code{@value{AS}} support these
40 Optimize for performance.
46 Produce little endian data output.
49 Produce little endian data output.
54 @item -mno-fp-as-gp-relax
55 Suppress fp-as-gp relaxation for this file.
58 Back-to-back branch optimization.
61 Suppress all relaxation for this file.
63 @item -march=<arch name>
64 Assemble for architecture <arch name> which could be v3, v3j, v3m, v3f,
65 v3s, v2, v2j, v2f, v2s.
67 @item -mbaseline=<baseline>
68 Assemble for baseline <baseline> which could be v2, v3, v3m.
70 @item -mfpu-freg=@var{FREG}
71 Specify a FPU configuration.
73 @item 0 8 SP / 4 DP registers
74 @item 1 16 SP / 8 DP registers
75 @item 2 32 SP / 16 DP registers
76 @item 3 32 SP / 32 DP registers
80 Specify a abi version <abi> could be v1, v2, v2fp, v2fpp.
83 Enable/Disable Multiply instructions support.
86 Enable/Disable Divide instructions support.
88 @item -m[no-]16bit-ext
89 Enable/Disable 16-bit extension
92 Enable/Disable d0/d1 registers
95 Enable/Disable Performance extension
97 @item -m[no-]perf2-ext
98 Enable/Disable Performance extension 2
100 @item -m[no-]string-ext
101 Enable/Disable String extension
103 @item -m[no-]reduced-regs
104 Enable/Disable Reduced Register configuration (GPR16) option
106 @item -m[no-]audio-isa-ext
107 Enable/Disable AUDIO ISA extension
109 @item -m[no-]fpu-sp-ext
110 Enable/Disable FPU SP extension
112 @item -m[no-]fpu-dp-ext
113 Enable/Disable FPU DP extension
116 Enable/Disable FPU fused-multiply-add instructions
119 Turn on all extensions and instructions support
127 * NDS32-Chars:: Special Characters
128 * NDS32-Regs:: Register Names
129 * NDS32-Ops:: Pseudo Instructions
133 @subsection Special Characters
135 Use @samp{#} at column 1 and @samp{!} anywhere in the line except inside
138 Multiple instructions in a line are allowed though not recommended and
139 should be separated by @samp{;}.
141 Assembler is not case-sensitive in general except user defined label.
142 For example, @samp{jral F1} is different from @samp{jral f1} while it is
143 the same as @samp{JRAL F1}.
146 @subsection Register Names
148 @item General purpose registers (GPR)
149 There are 32 32-bit general purpose registers $r0 to $r31.
151 @item Accumulators d0 and d1
152 64-bit accumulators: $d0.hi, $d0.lo, $d1.hi, and $d1.lo.
154 @item Assembler reserved register $ta
155 Register $ta ($r15) is reserved for assembler using.
157 @item Operating system reserved registers $p0 and $p1
158 Registers $p0 ($r26) and $p1 ($r27) are used by operating system as scratch
161 @item Frame pointer $fp
162 Register $r28 is regarded as the frame pointer.
165 Register $r29 is regarded as the global pointer.
168 Register $r30 is regarded as the link pointer.
171 Register $r31 is regarded as the stack pointer.
175 @subsection Pseudo Instructions
178 load 32-bit integer into register rt5. @samp{sethi rt5,hi20(imm32)} and then
179 @samp{ori rt5,reg,lo12(imm32)}.
182 Load 32-bit address of var into register rt5. @samp{sethi rt5,hi20(var)} and
183 then @samp{ori reg,rt5,lo12(var)}
185 @item l.[bhw] rt5,var
186 Load value of var into register rt5. @samp{sethi $ta,hi20(var)} and then
187 @samp{l[bhw]i rt5,[$ta+lo12(var)]}
189 @item l.[bh]s rt5,var
190 Load value of var into register rt5. @samp{sethi $ta,hi20(var)} and then
191 @samp{l[bh]si rt5,[$ta+lo12(var)]}
193 @item l.[bhw]p rt5,var,inc
194 Load value of var into register rt5 and increment $ta by amount inc.
195 @samp{la $ta,var} and then @samp{l[bhw]i.bi rt5,[$ta],inc}
197 @item l.[bhw]pc rt5,inc
198 Continue loading value of var into register rt5 and increment $ta by amount inc.
199 @samp{l[bhw]i.bi rt5,[$ta],inc.}
201 @item l.[bh]sp rt5,var,inc
202 Load value of var into register rt5 and increment $ta by amount inc.
203 @samp{la $ta,var} and then @samp{l[bh]si.bi rt5,[$ta],inc}
205 @item l.[bh]spc rt5,inc
206 Continue loading value of var into register rt5 and increment $ta by amount inc.
207 @samp{l[bh]si.bi rt5,[$ta],inc.}
209 @item s.[bhw] rt5,var
210 Store register rt5 to var.
211 @samp{sethi $ta,hi20(var)} and then @samp{s[bhw]i rt5,[$ta+lo12(var)]}
213 @item s.[bhw]p rt5,var,inc
214 Store register rt5 to var and increment $ta by amount inc.
215 @samp{la $ta,var} and then @samp{s[bhw]i.bi rt5,[$ta],inc}
217 @item s.[bhw]pc rt5,inc
218 Continue storing register rt5 to var and increment $ta by amount inc.
219 @samp{s[bhw]i.bi rt5,[$ta],inc.}
222 Alias of @samp{nor rt5,ra5,ra5}.
225 Alias of @samp{subri rt5,ra5,0}.
228 Depending on how it is assembled, it is translated into @samp{r5 rb5}
232 Branch to label depending on how it is assembled, it is translated into
233 @samp{j8 label}, @samp{j label}, or "@samp{la $ta,label} @samp{br $ta}".
236 Alias of jral br5 depending on how it is assembled, it is translated
237 into @samp{jral5 rb5} or @samp{jral rb5}.
240 Alias of jal fname depending on how it is assembled, it is translated into
241 @samp{jal fname} or "@samp{la $ta,fname} @samp{bral $ta}".
244 Call function fname same as @samp{jal fname}.
247 For 16-bit, this is @samp{mov55 rt5,ra5}.
248 For no 16-bit, this is @samp{ori rt5,ra5,0}.
251 This is the same as @samp{l.w rt5,var}.
254 This is the same as @samp{li rt5,imm32}.
257 Push contents of registers from ra5 to rb5 into stack.
260 Push content of register ra5 into stack. (same @samp{pushm ra5,ra5}).
263 Push value of double-word variable var into stack.
266 Push value of word variable var into stack.
269 Push value of half-word variable var into stack.
272 Push value of byte variable var into stack.
275 Push 32-bit address of variable var into stack.
278 Push 32-bit immediate value into stack.
281 Pop top of stack values into registers ra5 to rb5.
284 Pop top of stack value into register. (same as @samp{popm rt5,rt5}.)
287 Pop value of double-word variable var from stack using register ra5
288 as 2nd scratch register. (1st is $ta)
291 Pop value of word variable var from stack using register ra5.
294 Pop value of half-word variable var from stack using register ra5.
297 Pop value of byte variable var from stack using register ra5.