c-tilegx.texi 9.9 KB

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