c-tilepro.texi 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. @c Copyright (C) 2011-2022 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 TILEPro-Dependent
  7. @chapter TILEPro Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter TILEPro Dependent Features
  12. @end ifclear
  13. @cindex TILEPro support
  14. @menu
  15. * TILEPro Options:: TILEPro Options
  16. * TILEPro Syntax:: TILEPro Syntax
  17. * TILEPro Directives:: TILEPro Directives
  18. @end menu
  19. @node TILEPro Options
  20. @section Options
  21. @code{@value{AS}} has no machine-dependent command-line options for
  22. TILEPro.
  23. @node TILEPro Syntax
  24. @section Syntax
  25. @cindex TILEPro syntax
  26. @cindex syntax, TILEPro
  27. Block comments are delimited by @samp{/*} and @samp{*/}. End of line
  28. comments may be introduced by @samp{#}.
  29. Instructions consist of a leading opcode or macro name followed by
  30. whitespace and an optional comma-separated list of operands:
  31. @smallexample
  32. @var{opcode} [@var{operand}, @dots{}]
  33. @end smallexample
  34. Instructions must be separated by a newline or semicolon.
  35. There are two ways to write code: either write naked instructions,
  36. which the assembler is free to combine into VLIW bundles, or specify
  37. the VLIW bundles explicitly.
  38. Bundles are specified using curly braces:
  39. @smallexample
  40. @{ @var{add} r3,r4,r5 ; @var{add} r7,r8,r9 ; @var{lw} r10,r11 @}
  41. @end smallexample
  42. A bundle can span multiple lines. If you want to put multiple
  43. instructions on a line, whether in a bundle or not, you need to
  44. separate them with semicolons as in this example.
  45. A bundle may contain one or more instructions, up to the limit
  46. specified by the ISA (currently three). If fewer instructions are
  47. specified than the hardware supports in a bundle, the assembler
  48. inserts @code{fnop} instructions automatically.
  49. The assembler will prefer to preserve the ordering of instructions
  50. within the bundle, putting the first instruction in a lower-numbered
  51. pipeline than the next one, etc. This fact, combined with the
  52. optional use of explicit @code{fnop} or @code{nop} instructions,
  53. allows precise control over which pipeline executes each instruction.
  54. If the instructions cannot be bundled in the listed order, the
  55. assembler will automatically try to find a valid pipeline
  56. assignment. If there is no way to bundle the instructions together,
  57. the assembler reports an error.
  58. The assembler does not yet auto-bundle (automatically combine multiple
  59. instructions into one bundle), but it reserves the right to do so in
  60. the future. If you want to force an instruction to run by itself, put
  61. it in a bundle explicitly with curly braces and use @code{nop}
  62. instructions (not @code{fnop}) to fill the remaining pipeline slots in
  63. that bundle.
  64. @menu
  65. * TILEPro Opcodes:: Opcode Naming Conventions.
  66. * TILEPro Registers:: Register Naming.
  67. * TILEPro Modifiers:: Symbolic Operand Modifiers.
  68. @end menu
  69. @node TILEPro Opcodes
  70. @subsection Opcode Names
  71. @cindex TILEPro opcode names
  72. @cindex opcode names, TILEPro
  73. For a complete list of opcodes and descriptions of their semantics,
  74. see @cite{TILE Processor User Architecture Manual}, available upon
  75. request at www.tilera.com.
  76. @node TILEPro Registers
  77. @subsection Register Names
  78. @cindex TILEPro register names
  79. @cindex register names, TILEPro
  80. General-purpose registers are represented by predefined symbols of the
  81. form @samp{r@var{N}}, where @var{N} represents a number between
  82. @code{0} and @code{63}. However, the following registers have
  83. canonical names that must be used instead:
  84. @table @code
  85. @item r54
  86. sp
  87. @item r55
  88. lr
  89. @item r56
  90. sn
  91. @item r57
  92. idn0
  93. @item r58
  94. idn1
  95. @item r59
  96. udn0
  97. @item r60
  98. udn1
  99. @item r61
  100. udn2
  101. @item r62
  102. udn3
  103. @item r63
  104. zero
  105. @end table
  106. The assembler will emit a warning if a numeric name is used instead of
  107. the canonical name. The @code{.no_require_canonical_reg_names}
  108. assembler pseudo-op turns off this
  109. warning. @code{.require_canonical_reg_names} turns it back on.
  110. @node TILEPro Modifiers
  111. @subsection Symbolic Operand Modifiers
  112. @cindex TILEPro modifiers
  113. @cindex symbol modifiers, TILEPro
  114. The assembler supports several modifiers when using symbol addresses
  115. in TILEPro instruction operands. The general syntax is the following:
  116. @smallexample
  117. modifier(symbol)
  118. @end smallexample
  119. The following modifiers are supported:
  120. @table @code
  121. @item lo16
  122. This modifier is used to load the low 16 bits of the symbol's address,
  123. sign-extended to a 32-bit value (sign-extension allows it to be
  124. range-checked against signed 16 bit immediate operands without
  125. complaint).
  126. @item hi16
  127. This modifier is used to load the high 16 bits of the symbol's
  128. address, also sign-extended to a 32-bit value.
  129. @item ha16
  130. @code{ha16(N)} is identical to @code{hi16(N)}, except if
  131. @code{lo16(N)} is negative it adds one to the @code{hi16(N)}
  132. value. This way @code{lo16} and @code{ha16} can be added to create any
  133. 32-bit value using @code{auli}. For example, here is how you move an
  134. arbitrary 32-bit address into r3:
  135. @smallexample
  136. moveli r3, lo16(sym)
  137. auli r3, r3, ha16(sym)
  138. @end smallexample
  139. @item got
  140. This modifier is used to load the offset of the GOT entry
  141. corresponding to the symbol.
  142. @item got_lo16
  143. This modifier is used to load the sign-extended low 16 bits of the
  144. offset of the GOT entry corresponding to the symbol.
  145. @item got_hi16
  146. This modifier is used to load the sign-extended high 16 bits of the
  147. offset of the GOT entry corresponding to the symbol.
  148. @item got_ha16
  149. This modifier is like @code{got_hi16}, but it adds one if
  150. @code{got_lo16} of the input value is negative.
  151. @item plt
  152. This modifier is used for function symbols. It causes a
  153. @emph{procedure linkage table}, an array of code stubs, to be created
  154. at the time the shared object is created or linked against, together
  155. with a global offset table entry. The value is a pc-relative offset
  156. to the corresponding stub code in the procedure linkage table. This
  157. arrangement causes the run-time symbol resolver to be called to look
  158. up and set the value of the symbol the first time the function is
  159. called (at latest; depending environment variables). It is only safe
  160. to leave the symbol unresolved this way if all references are function
  161. calls.
  162. @item tls_gd
  163. This modifier is used to load the offset of the GOT entry of the
  164. symbol's TLS descriptor, to be used for general-dynamic TLS accesses.
  165. @item tls_gd_lo16
  166. This modifier is used to load the sign-extended low 16 bits of the
  167. offset of the GOT entry of the symbol's TLS descriptor, to be used for
  168. general dynamic TLS accesses.
  169. @item tls_gd_hi16
  170. This modifier is used to load the sign-extended high 16 bits of the
  171. offset of the GOT entry of the symbol's TLS descriptor, to be used for
  172. general dynamic TLS accesses.
  173. @item tls_gd_ha16
  174. This modifier is like @code{tls_gd_hi16}, but it adds one to the value
  175. if @code{tls_gd_lo16} of the input value is negative.
  176. @item tls_ie
  177. This modifier is used to load the offset of the GOT entry containing
  178. the offset of the symbol's address from the TCB, to be used for
  179. initial-exec TLS accesses.
  180. @item tls_ie_lo16
  181. This modifier is used to load the low 16 bits of the offset of the GOT
  182. entry containing the offset of the symbol's address from the TCB, to
  183. be used for initial-exec TLS accesses.
  184. @item tls_ie_hi16
  185. This modifier is used to load the high 16 bits of the offset of the
  186. GOT entry containing the offset of the symbol's address from the TCB,
  187. to be used for initial-exec TLS accesses.
  188. @item tls_ie_ha16
  189. This modifier is like @code{tls_ie_hi16}, but it adds one to the value
  190. if @code{tls_ie_lo16} of the input value is negative.
  191. @item tls_le
  192. This modifier is used to load the offset of the symbol's address from
  193. the TCB, to be used for local-exec TLS accesses.
  194. @item tls_le_lo16
  195. This modifier is used to load the low 16 bits of the offset of the
  196. symbol's address from the TCB, to be used for local-exec TLS accesses.
  197. @item tls_le_hi16
  198. This modifier is used to load the high 16 bits of the offset of the
  199. symbol's address from the TCB, to be used for local-exec TLS accesses.
  200. @item tls_le_ha16
  201. This modifier is like @code{tls_le_hi16}, but it adds one to the value
  202. if @code{tls_le_lo16} of the input value is negative.
  203. @item tls_gd_call
  204. This modifier is used to tag an instruction as the ``call'' part of a
  205. calling sequence for a TLS GD reference of its operand.
  206. @item tls_gd_add
  207. This modifier is used to tag an instruction as the ``add'' part of a
  208. calling sequence for a TLS GD reference of its operand.
  209. @item tls_ie_load
  210. This modifier is used to tag an instruction as the ``load'' part of a
  211. calling sequence for a TLS IE reference of its operand.
  212. @end table
  213. @node TILEPro Directives
  214. @section TILEPro Directives
  215. @cindex machine directives, TILEPro
  216. @cindex TILEPro machine directives
  217. @table @code
  218. @cindex @code{.align} directive, TILEPro
  219. @item .align @var{expression} [, @var{expression}]
  220. This is the generic @var{.align} directive. The first argument is the
  221. requested alignment in bytes.
  222. @cindex @code{.allow_suspicious_bundles} directive, TILEPro
  223. @item .allow_suspicious_bundles
  224. Turns on error checking for combinations of instructions in a bundle
  225. that probably indicate a programming error. This is on by default.
  226. @item .no_allow_suspicious_bundles
  227. Turns off error checking for combinations of instructions in a bundle
  228. that probably indicate a programming error.
  229. @cindex @code{.require_canonical_reg_names} directive, TILEPro
  230. @item .require_canonical_reg_names
  231. Require that canonical register names be used, and emit a warning if
  232. the numeric names are used. This is on by default.
  233. @item .no_require_canonical_reg_names
  234. Permit the use of numeric names for registers that have canonical
  235. names.
  236. @end table