c-m32r.texi 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. @c Copyright (C) 1991-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 M32R-Dependent
  7. @chapter M32R Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter M32R Dependent Features
  12. @end ifclear
  13. @cindex M32R support
  14. @menu
  15. * M32R-Opts:: M32R Options
  16. * M32R-Directives:: M32R Directives
  17. * M32R-Warnings:: M32R Warnings
  18. @end menu
  19. @node M32R-Opts
  20. @section M32R Options
  21. @cindex options, M32R
  22. @cindex M32R options
  23. The Renease M32R version of @code{@value{AS}} has a few machine
  24. dependent options:
  25. @table @code
  26. @item -m32rx
  27. @cindex @samp{-m32rx} option, M32RX
  28. @cindex architecture options, M32RX
  29. @cindex M32R architecture options
  30. @code{@value{AS}} can assemble code for several different members of the
  31. Renesas M32R family. Normally the default is to assemble code for
  32. the M32R microprocessor. This option may be used to change the default
  33. to the M32RX microprocessor, which adds some more instructions to the
  34. basic M32R instruction set, and some additional parameters to some of
  35. the original instructions.
  36. @item -m32r2
  37. @cindex @samp{-m32rx} option, M32R2
  38. @cindex architecture options, M32R2
  39. @cindex M32R architecture options
  40. This option changes the target processor to the M32R2
  41. microprocessor.
  42. @item -m32r
  43. @cindex @samp{-m32r} option, M32R
  44. @cindex architecture options, M32R
  45. @cindex M32R architecture options
  46. This option can be used to restore the assembler's default behaviour of
  47. assembling for the M32R microprocessor. This can be useful if the
  48. default has been changed by a previous command line option.
  49. @item -little
  50. @cindex @code{-little} option, M32R
  51. This option tells the assembler to produce little-endian code and
  52. data. The default is dependent upon how the toolchain was
  53. configured.
  54. @item -EL
  55. @cindex @code{-EL} option, M32R
  56. This is a synonym for @emph{-little}.
  57. @item -big
  58. @cindex @code{-big} option, M32R
  59. This option tells the assembler to produce big-endian code and
  60. data.
  61. @item -EB
  62. @cindex @code{-EB} option, M32R
  63. This is a synonum for @emph{-big}.
  64. @item -KPIC
  65. @cindex @code{-KPIC} option, M32R
  66. @cindex PIC code generation for M32R
  67. This option specifies that the output of the assembler should be
  68. marked as position-independent code (PIC).
  69. @item -parallel
  70. @cindex @code{-parallel} option, M32RX
  71. This option tells the assembler to attempts to combine two sequential
  72. instructions into a single, parallel instruction, where it is legal to
  73. do so.
  74. @item -no-parallel
  75. @cindex @code{-no-parallel} option, M32RX
  76. This option disables a previously enabled @emph{-parallel} option.
  77. @item -no-bitinst
  78. @cindex @samp{-no-bitinst}, M32R2
  79. This option disables the support for the extended bit-field
  80. instructions provided by the M32R2. If this support needs to be
  81. re-enabled the @emph{-bitinst} switch can be used to restore it.
  82. @item -O
  83. @cindex @code{-O} option, M32RX
  84. This option tells the assembler to attempt to optimize the
  85. instructions that it produces. This includes filling delay slots and
  86. converting sequential instructions into parallel ones. This option
  87. implies @emph{-parallel}.
  88. @item -warn-explicit-parallel-conflicts
  89. @cindex @samp{-warn-explicit-parallel-conflicts} option, M32RX
  90. Instructs @code{@value{AS}} to produce warning messages when
  91. questionable parallel instructions are encountered. This option is
  92. enabled by default, but @code{@value{GCC}} disables it when it invokes
  93. @code{@value{AS}} directly. Questionable instructions are those whose
  94. behaviour would be different if they were executed sequentially. For
  95. example the code fragment @samp{mv r1, r2 || mv r3, r1} produces a
  96. different result from @samp{mv r1, r2 \n mv r3, r1} since the former
  97. moves r1 into r3 and then r2 into r1, whereas the later moves r2 into r1
  98. and r3.
  99. @item -Wp
  100. @cindex @samp{-Wp} option, M32RX
  101. This is a shorter synonym for the @emph{-warn-explicit-parallel-conflicts}
  102. option.
  103. @item -no-warn-explicit-parallel-conflicts
  104. @cindex @samp{-no-warn-explicit-parallel-conflicts} option, M32RX
  105. Instructs @code{@value{AS}} not to produce warning messages when
  106. questionable parallel instructions are encountered.
  107. @item -Wnp
  108. @cindex @samp{-Wnp} option, M32RX
  109. This is a shorter synonym for the @emph{-no-warn-explicit-parallel-conflicts}
  110. option.
  111. @item -ignore-parallel-conflicts
  112. @cindex @samp{-ignore-parallel-conflicts} option, M32RX
  113. This option tells the assembler's to stop checking parallel
  114. instructions for constraint violations. This ability is provided for
  115. hardware vendors testing chip designs and should not be used under
  116. normal circumstances.
  117. @item -no-ignore-parallel-conflicts
  118. @cindex @samp{-no-ignore-parallel-conflicts} option, M32RX
  119. This option restores the assembler's default behaviour of checking
  120. parallel instructions to detect constraint violations.
  121. @item -Ip
  122. @cindex @samp{-Ip} option, M32RX
  123. This is a shorter synonym for the @emph{-ignore-parallel-conflicts}
  124. option.
  125. @item -nIp
  126. @cindex @samp{-nIp} option, M32RX
  127. This is a shorter synonym for the @emph{-no-ignore-parallel-conflicts}
  128. option.
  129. @item -warn-unmatched-high
  130. @cindex @samp{-warn-unmatched-high} option, M32R
  131. This option tells the assembler to produce a warning message if a
  132. @code{.high} pseudo op is encountered without a matching @code{.low}
  133. pseudo op. The presence of such an unmatched pseudo op usually
  134. indicates a programming error.
  135. @item -no-warn-unmatched-high
  136. @cindex @samp{-no-warn-unmatched-high} option, M32R
  137. Disables a previously enabled @emph{-warn-unmatched-high} option.
  138. @item -Wuh
  139. @cindex @samp{-Wuh} option, M32RX
  140. This is a shorter synonym for the @emph{-warn-unmatched-high} option.
  141. @item -Wnuh
  142. @cindex @samp{-Wnuh} option, M32RX
  143. This is a shorter synonym for the @emph{-no-warn-unmatched-high} option.
  144. @end table
  145. @node M32R-Directives
  146. @section M32R Directives
  147. @cindex directives, M32R
  148. @cindex M32R directives
  149. The Renease M32R version of @code{@value{AS}} has a few architecture
  150. specific directives:
  151. @table @code
  152. @cindex @code{low} directive, M32R
  153. @item low @var{expression}
  154. The @code{low} directive computes the value of its expression and
  155. places the lower 16-bits of the result into the immediate-field of the
  156. instruction. For example:
  157. @smallexample
  158. or3 r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678
  159. add3, r0, r0, #low(fred) ; compute r0 = r0 + low 16-bits of address of fred
  160. @end smallexample
  161. @item high @var{expression}
  162. @cindex @code{high} directive, M32R
  163. The @code{high} directive computes the value of its expression and
  164. places the upper 16-bits of the result into the immediate-field of the
  165. instruction. For example:
  166. @smallexample
  167. seth r0, #high(0x12345678) ; compute r0 = 0x12340000
  168. seth, r0, #high(fred) ; compute r0 = upper 16-bits of address of fred
  169. @end smallexample
  170. @item shigh @var{expression}
  171. @cindex @code{shigh} directive, M32R
  172. The @code{shigh} directive is very similar to the @code{high}
  173. directive. It also computes the value of its expression and places
  174. the upper 16-bits of the result into the immediate-field of the
  175. instruction. The difference is that @code{shigh} also checks to see
  176. if the lower 16-bits could be interpreted as a signed number, and if
  177. so it assumes that a borrow will occur from the upper-16 bits. To
  178. compensate for this the @code{shigh} directive pre-biases the upper
  179. 16 bit value by adding one to it. For example:
  180. For example:
  181. @smallexample
  182. seth r0, #shigh(0x12345678) ; compute r0 = 0x12340000
  183. seth r0, #shigh(0x00008000) ; compute r0 = 0x00010000
  184. @end smallexample
  185. In the second example the lower 16-bits are 0x8000. If these are
  186. treated as a signed value and sign extended to 32-bits then the value
  187. becomes 0xffff8000. If this value is then added to 0x00010000 then
  188. the result is 0x00008000.
  189. This behaviour is to allow for the different semantics of the
  190. @code{or3} and @code{add3} instructions. The @code{or3} instruction
  191. treats its 16-bit immediate argument as unsigned whereas the
  192. @code{add3} treats its 16-bit immediate as a signed value. So for
  193. example:
  194. @smallexample
  195. seth r0, #shigh(0x00008000)
  196. add3 r0, r0, #low(0x00008000)
  197. @end smallexample
  198. Produces the correct result in r0, whereas:
  199. @smallexample
  200. seth r0, #shigh(0x00008000)
  201. or3 r0, r0, #low(0x00008000)
  202. @end smallexample
  203. Stores 0xffff8000 into r0.
  204. Note - the @code{shigh} directive does not know where in the assembly
  205. source code the lower 16-bits of the value are going set, so it cannot
  206. check to make sure that an @code{or3} instruction is being used rather
  207. than an @code{add3} instruction. It is up to the programmer to make
  208. sure that correct directives are used.
  209. @cindex @code{.m32r} directive, M32R
  210. @item .m32r
  211. The directive performs a similar thing as the @emph{-m32r} command
  212. line option. It tells the assembler to only accept M32R instructions
  213. from now on. An instructions from later M32R architectures are
  214. refused.
  215. @cindex @code{.m32rx} directive, M32RX
  216. @item .m32rx
  217. The directive performs a similar thing as the @emph{-m32rx} command
  218. line option. It tells the assembler to start accepting the extra
  219. instructions in the M32RX ISA as well as the ordinary M32R ISA.
  220. @cindex @code{.m32r2} directive, M32R2
  221. @item .m32r2
  222. The directive performs a similar thing as the @emph{-m32r2} command
  223. line option. It tells the assembler to start accepting the extra
  224. instructions in the M32R2 ISA as well as the ordinary M32R ISA.
  225. @cindex @code{.little} directive, M32RX
  226. @item .little
  227. The directive performs a similar thing as the @emph{-little} command
  228. line option. It tells the assembler to start producing little-endian
  229. code and data. This option should be used with care as producing
  230. mixed-endian binary files is fraught with danger.
  231. @cindex @code{.big} directive, M32RX
  232. @item .big
  233. The directive performs a similar thing as the @emph{-big} command
  234. line option. It tells the assembler to start producing big-endian
  235. code and data. This option should be used with care as producing
  236. mixed-endian binary files is fraught with danger.
  237. @end table
  238. @node M32R-Warnings
  239. @section M32R Warnings
  240. @cindex warnings, M32R
  241. @cindex M32R warnings
  242. There are several warning and error messages that can be produced by
  243. @code{@value{AS}} which are specific to the M32R:
  244. @table @code
  245. @item output of 1st instruction is the same as an input to 2nd instruction - is this intentional ?
  246. This message is only produced if warnings for explicit parallel
  247. conflicts have been enabled. It indicates that the assembler has
  248. encountered a parallel instruction in which the destination register of
  249. the left hand instruction is used as an input register in the right hand
  250. instruction. For example in this code fragment
  251. @samp{mv r1, r2 || neg r3, r1} register r1 is the destination of the
  252. move instruction and the input to the neg instruction.
  253. @item output of 2nd instruction is the same as an input to 1st instruction - is this intentional ?
  254. This message is only produced if warnings for explicit parallel
  255. conflicts have been enabled. It indicates that the assembler has
  256. encountered a parallel instruction in which the destination register of
  257. the right hand instruction is used as an input register in the left hand
  258. instruction. For example in this code fragment
  259. @samp{mv r1, r2 || neg r2, r3} register r2 is the destination of the
  260. neg instruction and the input to the move instruction.
  261. @item instruction @samp{...} is for the M32RX only
  262. This message is produced when the assembler encounters an instruction
  263. which is only supported by the M32Rx processor, and the @samp{-m32rx}
  264. command line flag has not been specified to allow assembly of such
  265. instructions.
  266. @item unknown instruction @samp{...}
  267. This message is produced when the assembler encounters an instruction
  268. which it does not recognize.
  269. @item only the NOP instruction can be issued in parallel on the m32r
  270. This message is produced when the assembler encounters a parallel
  271. instruction which does not involve a NOP instruction and the
  272. @samp{-m32rx} command line flag has not been specified. Only the M32Rx
  273. processor is able to execute two instructions in parallel.
  274. @item instruction @samp{...} cannot be executed in parallel.
  275. This message is produced when the assembler encounters a parallel
  276. instruction which is made up of one or two instructions which cannot be
  277. executed in parallel.
  278. @item Instructions share the same execution pipeline
  279. This message is produced when the assembler encounters a parallel
  280. instruction whoes components both use the same execution pipeline.
  281. @item Instructions write to the same destination register.
  282. This message is produced when the assembler encounters a parallel
  283. instruction where both components attempt to modify the same register.
  284. For example these code fragments will produce this message:
  285. @samp{mv r1, r2 || neg r1, r3}
  286. @samp{jl r0 || mv r14, r1}
  287. @samp{st r2, @@-r1 || mv r1, r3}
  288. @samp{mv r1, r2 || ld r0, @@r1+}
  289. @samp{cmp r1, r2 || addx r3, r4} (Both write to the condition bit)
  290. @end table