c-d30v.texi 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. @c Copyright (C) 1997-2015 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @ifset GENERIC
  5. @page
  6. @node D30V-Dependent
  7. @chapter D30V Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter D30V Dependent Features
  12. @end ifclear
  13. @cindex D30V support
  14. @menu
  15. * D30V-Opts:: D30V Options
  16. * D30V-Syntax:: Syntax
  17. * D30V-Float:: Floating Point
  18. * D30V-Opcodes:: Opcodes
  19. @end menu
  20. @node D30V-Opts
  21. @section D30V Options
  22. @cindex options, D30V
  23. @cindex D30V options
  24. The Mitsubishi D30V version of @code{@value{AS}} has a few machine
  25. dependent options.
  26. @table @samp
  27. @item -O
  28. The D30V can often execute two sub-instructions in parallel. When this option
  29. is used, @code{@value{AS}} will attempt to optimize its output by detecting when
  30. instructions can be executed in parallel.
  31. @item -n
  32. When this option is used, @code{@value{AS}} will issue a warning every
  33. time it adds a nop instruction.
  34. @item -N
  35. When this option is used, @code{@value{AS}} will issue a warning if it
  36. needs to insert a nop after a 32-bit multiply before a load or 16-bit
  37. multiply instruction.
  38. @end table
  39. @node D30V-Syntax
  40. @section Syntax
  41. @cindex D30V syntax
  42. @cindex syntax, D30V
  43. The D30V syntax is based on the syntax in Mitsubishi's D30V architecture manual.
  44. The differences are detailed below.
  45. @menu
  46. * D30V-Size:: Size Modifiers
  47. * D30V-Subs:: Sub-Instructions
  48. * D30V-Chars:: Special Characters
  49. * D30V-Guarded:: Guarded Execution
  50. * D30V-Regs:: Register Names
  51. * D30V-Addressing:: Addressing Modes
  52. @end menu
  53. @node D30V-Size
  54. @subsection Size Modifiers
  55. @cindex D30V size modifiers
  56. @cindex size modifiers, D30V
  57. The D30V version of @code{@value{AS}} uses the instruction names in the D30V
  58. Architecture Manual. However, the names in the manual are sometimes ambiguous.
  59. There are instruction names that can assemble to a short or long form opcode.
  60. How does the assembler pick the correct form? @code{@value{AS}} will always pick the
  61. smallest form if it can. When dealing with a symbol that is not defined yet when a
  62. line is being assembled, it will always use the long form. If you need to force the
  63. assembler to use either the short or long form of the instruction, you can append
  64. either @samp{.s} (short) or @samp{.l} (long) to it. For example, if you are writing
  65. an assembly program and you want to do a branch to a symbol that is defined later
  66. in your program, you can write @samp{bra.s foo}.
  67. Objdump and GDB will always append @samp{.s} or @samp{.l} to instructions which
  68. have both short and long forms.
  69. @node D30V-Subs
  70. @subsection Sub-Instructions
  71. @cindex D30V sub-instructions
  72. @cindex sub-instructions, D30V
  73. The D30V assembler takes as input a series of instructions, either one-per-line,
  74. or in the special two-per-line format described in the next section. Some of these
  75. instructions will be short-form or sub-instructions. These sub-instructions can be packed
  76. into a single instruction. The assembler will do this automatically. It will also detect
  77. when it should not pack instructions. For example, when a label is defined, the next
  78. instruction will never be packaged with the previous one. Whenever a branch and link
  79. instruction is called, it will not be packaged with the next instruction so the return
  80. address will be valid. Nops are automatically inserted when necessary.
  81. If you do not want the assembler automatically making these decisions, you can control
  82. the packaging and execution type (parallel or sequential) with the special execution
  83. symbols described in the next section.
  84. @node D30V-Chars
  85. @subsection Special Characters
  86. @cindex line comment character, D30V
  87. @cindex D30V line comment character
  88. A semicolon (@samp{;}) can be used anywhere on a line to start a
  89. comment that extends to the end of the line.
  90. If a @samp{#} appears as the first character of a line, the whole line
  91. is treated as a comment, but in this case the line could also be a
  92. logical line number directive (@pxref{Comments}) or a preprocessor
  93. control command (@pxref{Preprocessing}).
  94. @cindex sub-instruction ordering, D30V
  95. @cindex D30V sub-instruction ordering
  96. Sub-instructions may be executed in order, in reverse-order, or in parallel.
  97. Instructions listed in the standard one-per-line format will be executed
  98. sequentially unless you use the @samp{-O} option.
  99. To specify the executing order, use the following symbols:
  100. @table @samp
  101. @item ->
  102. Sequential with instruction on the left first.
  103. @item <-
  104. Sequential with instruction on the right first.
  105. @item ||
  106. Parallel
  107. @end table
  108. The D30V syntax allows either one instruction per line, one instruction per line with
  109. the execution symbol, or two instructions per line. For example
  110. @table @code
  111. @item abs r2,r3 -> abs r4,r5
  112. Execute these sequentially. The instruction on the right is in the right
  113. container and is executed second.
  114. @item abs r2,r3 <- abs r4,r5
  115. Execute these reverse-sequentially. The instruction on the right is in the right
  116. container, and is executed first.
  117. @item abs r2,r3 || abs r4,r5
  118. Execute these in parallel.
  119. @item ldw r2,@@(r3,r4) ||
  120. @itemx mulx r6,r8,r9
  121. Two-line format. Execute these in parallel.
  122. @item mulx a0,r8,r9
  123. @itemx stw r2,@@(r3,r4)
  124. Two-line format. Execute these sequentially unless @samp{-O} option is
  125. used. If the @samp{-O} option is used, the assembler will determine if
  126. the instructions could be done in parallel (the above two instructions
  127. can be done in parallel), and if so, emit them as parallel instructions.
  128. The assembler will put them in the proper containers. In the above
  129. example, the assembler will put the @samp{stw} instruction in left
  130. container and the @samp{mulx} instruction in the right container.
  131. @item stw r2,@@(r3,r4) ->
  132. @itemx mulx a0,r8,r9
  133. Two-line format. Execute the @samp{stw} instruction followed by the
  134. @samp{mulx} instruction sequentially. The first instruction goes in the
  135. left container and the second instruction goes into right container.
  136. The assembler will give an error if the machine ordering constraints are
  137. violated.
  138. @item stw r2,@@(r3,r4) <-
  139. @itemx mulx a0,r8,r9
  140. Same as previous example, except that the @samp{mulx} instruction is
  141. executed before the @samp{stw} instruction.
  142. @end table
  143. @cindex symbol names, @samp{$} in
  144. @cindex @code{$} in symbol names
  145. Since @samp{$} has no special meaning, you may use it in symbol names.
  146. @node D30V-Guarded
  147. @subsection Guarded Execution
  148. @cindex D30V Guarded Execution
  149. @code{@value{AS}} supports the full range of guarded execution
  150. directives for each instruction. Just append the directive after the
  151. instruction proper. The directives are:
  152. @table @samp
  153. @item /tx
  154. Execute the instruction if flag f0 is true.
  155. @item /fx
  156. Execute the instruction if flag f0 is false.
  157. @item /xt
  158. Execute the instruction if flag f1 is true.
  159. @item /xf
  160. Execute the instruction if flag f1 is false.
  161. @item /tt
  162. Execute the instruction if both flags f0 and f1 are true.
  163. @item /tf
  164. Execute the instruction if flag f0 is true and flag f1 is false.
  165. @end table
  166. @node D30V-Regs
  167. @subsection Register Names
  168. @cindex D30V registers
  169. @cindex registers, D30V
  170. You can use the predefined symbols @samp{r0} through @samp{r63} to refer
  171. to the D30V registers. You can also use @samp{sp} as an alias for
  172. @samp{r63} and @samp{link} as an alias for @samp{r62}. The accumulators
  173. are @samp{a0} and @samp{a1}.
  174. The D30V also has predefined symbols for these control registers and status bits:
  175. @table @code
  176. @item psw
  177. Processor Status Word
  178. @item bpsw
  179. Backup Processor Status Word
  180. @item pc
  181. Program Counter
  182. @item bpc
  183. Backup Program Counter
  184. @item rpt_c
  185. Repeat Count
  186. @item rpt_s
  187. Repeat Start address
  188. @item rpt_e
  189. Repeat End address
  190. @item mod_s
  191. Modulo Start address
  192. @item mod_e
  193. Modulo End address
  194. @item iba
  195. Instruction Break Address
  196. @item f0
  197. Flag 0
  198. @item f1
  199. Flag 1
  200. @item f2
  201. Flag 2
  202. @item f3
  203. Flag 3
  204. @item f4
  205. Flag 4
  206. @item f5
  207. Flag 5
  208. @item f6
  209. Flag 6
  210. @item f7
  211. Flag 7
  212. @item s
  213. Same as flag 4 (saturation flag)
  214. @item v
  215. Same as flag 5 (overflow flag)
  216. @item va
  217. Same as flag 6 (sticky overflow flag)
  218. @item c
  219. Same as flag 7 (carry/borrow flag)
  220. @item b
  221. Same as flag 7 (carry/borrow flag)
  222. @end table
  223. @node D30V-Addressing
  224. @subsection Addressing Modes
  225. @cindex addressing modes, D30V
  226. @cindex D30V addressing modes
  227. @code{@value{AS}} understands the following addressing modes for the D30V.
  228. @code{R@var{n}} in the following refers to any of the numbered
  229. registers, but @emph{not} the control registers.
  230. @table @code
  231. @item R@var{n}
  232. Register direct
  233. @item @@R@var{n}
  234. Register indirect
  235. @item @@R@var{n}+
  236. Register indirect with post-increment
  237. @item @@R@var{n}-
  238. Register indirect with post-decrement
  239. @item @@-SP
  240. Register indirect with pre-decrement
  241. @item @@(@var{disp}, R@var{n})
  242. Register indirect with displacement
  243. @item @var{addr}
  244. PC relative address (for branch or rep).
  245. @item #@var{imm}
  246. Immediate data (the @samp{#} is optional and ignored)
  247. @end table
  248. @node D30V-Float
  249. @section Floating Point
  250. @cindex floating point, D30V
  251. @cindex D30V floating point
  252. The D30V has no hardware floating point, but the @code{.float} and @code{.double}
  253. directives generates @sc{ieee} floating-point numbers for compatibility
  254. with other development tools.
  255. @node D30V-Opcodes
  256. @section Opcodes
  257. @cindex D30V opcode summary
  258. @cindex opcode summary, D30V
  259. @cindex mnemonics, D30V
  260. @cindex instruction summary, D30V
  261. For detailed information on the D30V machine instruction set, see
  262. @cite{D30V Architecture: A VLIW Microprocessor for Multimedia Applications}
  263. (Mitsubishi Electric Corp.).
  264. @code{@value{AS}} implements all the standard D30V opcodes. The only changes are those
  265. described in the section on size modifiers