ARC-Directives.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: ARC Directives</title>
  15. <meta name="description" content="Using as: ARC Directives">
  16. <meta name="keywords" content="Using as: ARC Directives">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="ARC_002dDependent.html#ARC_002dDependent" rel="up" title="ARC-Dependent">
  25. <link href="ARC-Modifiers.html#ARC-Modifiers" rel="next" title="ARC Modifiers">
  26. <link href="ARC_002dRegs.html#ARC_002dRegs" rel="prev" title="ARC-Regs">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="ARC-Directives"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="ARC-Modifiers.html#ARC-Modifiers" accesskey="n" rel="next">ARC Modifiers</a>, Previous: <a href="ARC-Syntax.html#ARC-Syntax" accesskey="p" rel="prev">ARC Syntax</a>, Up: <a href="ARC_002dDependent.html#ARC_002dDependent" accesskey="u" rel="up">ARC-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="ARC-Machine-Directives"></a>
  64. <h4 class="subsection">9.3.3 ARC Machine Directives</h4>
  65. <a name="index-machine-directives_002c-ARC"></a>
  66. <a name="index-ARC-machine-directives"></a>
  67. <p>The ARC version of <code>as</code> supports the following additional
  68. machine directives:
  69. </p>
  70. <dl compact="compact">
  71. <dd>
  72. <a name="index-lcomm-directive-1"></a>
  73. </dd>
  74. <dt><code>.lcomm <var>symbol</var>, <var>length</var>[, <var>alignment</var>]</code></dt>
  75. <dd><p>Reserve <var>length</var> (an absolute expression) bytes for a local common
  76. denoted by <var>symbol</var>. The section and value of <var>symbol</var> are
  77. those of the new local common. The addresses are allocated in the bss
  78. section, so that at run-time the bytes start off zeroed. Since
  79. <var>symbol</var> is not declared global, it is normally not visible to
  80. <code>ld</code>. The optional third parameter, <var>alignment</var>,
  81. specifies the desired alignment of the symbol in the bss section,
  82. specified as a byte boundary (for example, an alignment of 16 means
  83. that the least significant 4 bits of the address should be zero). The
  84. alignment must be an absolute expression, and it must be a power of
  85. two. If no alignment is specified, as will set the alignment to the
  86. largest power of two less than or equal to the size of the symbol, up
  87. to a maximum of 16.
  88. </p>
  89. <a name="index-lcommon-directive_002c-ARC"></a>
  90. </dd>
  91. <dt><code>.lcommon <var>symbol</var>, <var>length</var>[, <var>alignment</var>]</code></dt>
  92. <dd><p>The same as <code>lcomm</code> directive.
  93. </p>
  94. <a name="index-cpu-directive_002c-ARC"></a>
  95. </dd>
  96. <dt><code>.cpu <var>cpu</var></code></dt>
  97. <dd><p>The <code>.cpu</code> directive must be followed by the desired core
  98. version. Permitted values for CPU are:
  99. </p><dl compact="compact">
  100. <dt><code>ARC600</code></dt>
  101. <dd><p>Assemble for the ARC600 instruction set.
  102. </p>
  103. </dd>
  104. <dt><code>arc600_norm</code></dt>
  105. <dd><p>Assemble for ARC 600 with norm instructions.
  106. </p>
  107. </dd>
  108. <dt><code>arc600_mul64</code></dt>
  109. <dd><p>Assemble for ARC 600 with mul64 instructions.
  110. </p>
  111. </dd>
  112. <dt><code>arc600_mul32x16</code></dt>
  113. <dd><p>Assemble for ARC 600 with mul32x16 instructions.
  114. </p>
  115. </dd>
  116. <dt><code>arc601</code></dt>
  117. <dd><p>Assemble for ARC 601 instruction set.
  118. </p>
  119. </dd>
  120. <dt><code>arc601_norm</code></dt>
  121. <dd><p>Assemble for ARC 601 with norm instructions.
  122. </p>
  123. </dd>
  124. <dt><code>arc601_mul64</code></dt>
  125. <dd><p>Assemble for ARC 601 with mul64 instructions.
  126. </p>
  127. </dd>
  128. <dt><code>arc601_mul32x16</code></dt>
  129. <dd><p>Assemble for ARC 601 with mul32x16 instructions.
  130. </p>
  131. </dd>
  132. <dt><code>ARC700</code></dt>
  133. <dd><p>Assemble for the ARC700 instruction set.
  134. </p>
  135. </dd>
  136. <dt><code>NPS400</code></dt>
  137. <dd><p>Assemble for the NPS400 instruction set.
  138. </p>
  139. </dd>
  140. <dt><code>EM</code></dt>
  141. <dd><p>Assemble for the ARC EM instruction set.
  142. </p>
  143. </dd>
  144. <dt><code>arcem</code></dt>
  145. <dd><p>Assemble for ARC EM instruction set
  146. </p>
  147. </dd>
  148. <dt><code>em4</code></dt>
  149. <dd><p>Assemble for ARC EM with code-density instructions.
  150. </p>
  151. </dd>
  152. <dt><code>em4_dmips</code></dt>
  153. <dd><p>Assemble for ARC EM with code-density instructions.
  154. </p>
  155. </dd>
  156. <dt><code>em4_fpus</code></dt>
  157. <dd><p>Assemble for ARC EM with code-density instructions.
  158. </p>
  159. </dd>
  160. <dt><code>em4_fpuda</code></dt>
  161. <dd><p>Assemble for ARC EM with code-density, and double-precision assist
  162. instructions.
  163. </p>
  164. </dd>
  165. <dt><code>quarkse_em</code></dt>
  166. <dd><p>Assemble for QuarkSE-EM instruction set.
  167. </p>
  168. </dd>
  169. <dt><code>HS</code></dt>
  170. <dd><p>Assemble for the ARC HS instruction set.
  171. </p>
  172. </dd>
  173. <dt><code>archs</code></dt>
  174. <dd><p>Assemble for ARC HS instruction set.
  175. </p>
  176. </dd>
  177. <dt><code>hs</code></dt>
  178. <dd><p>Assemble for ARC HS instruction set.
  179. </p>
  180. </dd>
  181. <dt><code>hs34</code></dt>
  182. <dd><p>Assemble for ARC HS34 instruction set.
  183. </p>
  184. </dd>
  185. <dt><code>hs38</code></dt>
  186. <dd><p>Assemble for ARC HS38 instruction set.
  187. </p>
  188. </dd>
  189. <dt><code>hs38_linux</code></dt>
  190. <dd><p>Assemble for ARC HS38 with floating point support on.
  191. </p>
  192. </dd>
  193. </dl>
  194. <p>Note: the <code>.cpu</code> directive overrides the command line option
  195. <code>-mcpu=<var>cpu</var></code>; a warning is emitted when the version is not
  196. consistent between the two.
  197. </p>
  198. </dd>
  199. <dt><code>.extAuxRegister <var>name</var>, <var>addr</var>, <var>mode</var></code></dt>
  200. <dd><a name="index-extAuxRegister-directive_002c-ARC"></a>
  201. <p>Auxiliary registers can be defined in the assembler source code by
  202. using this directive. The first parameter, <var>name</var>, is the name of the
  203. new auxiliary register. The second parameter, <var>addr</var>, is
  204. address the of the auxiliary register. The third parameter,
  205. <var>mode</var>, specifies whether the register is readable and/or writable
  206. and is one of:
  207. </p><dl compact="compact">
  208. <dt><code>r</code></dt>
  209. <dd><p>Read only;
  210. </p>
  211. </dd>
  212. <dt><code>w</code></dt>
  213. <dd><p>Write only;
  214. </p>
  215. </dd>
  216. <dt><code>r|w</code></dt>
  217. <dd><p>Read and write.
  218. </p>
  219. </dd>
  220. </dl>
  221. <p>For example:
  222. </p><div class="example">
  223. <pre class="example"> .extAuxRegister mulhi, 0x12, w
  224. </pre></div>
  225. <p>specifies a write only extension auxiliary register, <var>mulhi</var> at
  226. address 0x12.
  227. </p>
  228. </dd>
  229. <dt><code>.extCondCode <var>suffix</var>, <var>val</var></code></dt>
  230. <dd><a name="index-extCondCode-directive_002c-ARC"></a>
  231. <p>ARC supports extensible condition codes. This directive defines a new
  232. condition code, to be known by the suffix, <var>suffix</var> and will
  233. depend on the value, <var>val</var> in the condition code.
  234. </p>
  235. <p>For example:
  236. </p><div class="example">
  237. <pre class="example"> .extCondCode is_busy,0x14
  238. add.is_busy r1,r2,r3
  239. </pre></div>
  240. <p>will only execute the <code>add</code> instruction if the condition code
  241. value is 0x14.
  242. </p>
  243. </dd>
  244. <dt><code>.extCoreRegister <var>name</var>, <var>regnum</var>, <var>mode</var>, <var>shortcut</var></code></dt>
  245. <dd><a name="index-extCoreRegister-directive_002c-ARC"></a>
  246. <p>Specifies an extension core register named <var>name</var> as a synonym for
  247. the register numbered <var>regnum</var>. The register number must be
  248. between 32 and 59. The third argument, <var>mode</var>, indicates whether
  249. the register is readable and/or writable and is one of:
  250. </p><dl compact="compact">
  251. <dt><code>r</code></dt>
  252. <dd><p>Read only;
  253. </p>
  254. </dd>
  255. <dt><code>w</code></dt>
  256. <dd><p>Write only;
  257. </p>
  258. </dd>
  259. <dt><code>r|w</code></dt>
  260. <dd><p>Read and write.
  261. </p>
  262. </dd>
  263. </dl>
  264. <p>The final parameter, <var>shortcut</var> indicates whether the register has
  265. a short cut in the pipeline. The valid values are:
  266. </p><dl compact="compact">
  267. <dt><code>can_shortcut</code></dt>
  268. <dd><p>The register has a short cut in the pipeline;
  269. </p>
  270. </dd>
  271. <dt><code>cannot_shortcut</code></dt>
  272. <dd><p>The register does not have a short cut in the pipeline.
  273. </p></dd>
  274. </dl>
  275. <p>For example:
  276. </p><div class="example">
  277. <pre class="example"> .extCoreRegister mlo, 57, r , can_shortcut
  278. </pre></div>
  279. <p>defines a read only extension core register, <code>mlo</code>, which is
  280. register 57, and can short cut the pipeline.
  281. </p>
  282. </dd>
  283. <dt><code>.extInstruction <var>name</var>, <var>opcode</var>, <var>subopcode</var>, <var>suffixclass</var>, <var>syntaxclass</var></code></dt>
  284. <dd><a name="index-extInstruction-directive_002c-ARC"></a>
  285. <p>ARC allows the user to specify extension instructions. These
  286. extension instructions are not macros; the assembler creates encodings
  287. for use of these instructions according to the specification by the
  288. user.
  289. </p>
  290. <p>The first argument, <var>name</var>, gives the name of the instruction.
  291. </p>
  292. <p>The second argument, <var>opcode</var>, is the opcode to be used (bits 31:27
  293. in the encoding).
  294. </p>
  295. <p>The third argument, <var>subopcode</var>, is the sub-opcode to be used, but
  296. the correct value also depends on the fifth argument,
  297. <var>syntaxclass</var>
  298. </p>
  299. <p>The fourth argument, <var>suffixclass</var>, determines the kinds of
  300. suffixes to be allowed. Valid values are:
  301. </p><dl compact="compact">
  302. <dt><code>SUFFIX_NONE</code></dt>
  303. <dd><p>No suffixes are permitted;
  304. </p>
  305. </dd>
  306. <dt><code>SUFFIX_COND</code></dt>
  307. <dd><p>Conditional suffixes are permitted;
  308. </p>
  309. </dd>
  310. <dt><code>SUFFIX_FLAG</code></dt>
  311. <dd><p>Flag setting suffixes are permitted.
  312. </p>
  313. </dd>
  314. <dt><code>SUFFIX_COND|SUFFIX_FLAG</code></dt>
  315. <dd><p>Both conditional and flag setting suffices are permitted.
  316. </p>
  317. </dd>
  318. </dl>
  319. <p>The fifth and final argument, <var>syntaxclass</var>, determines the syntax
  320. class for the instruction. It can have the following values:
  321. </p><dl compact="compact">
  322. <dt><code>SYNTAX_2OP</code></dt>
  323. <dd><p>Two Operand Instruction;
  324. </p>
  325. </dd>
  326. <dt><code>SYNTAX_3OP</code></dt>
  327. <dd><p>Three Operand Instruction.
  328. </p>
  329. </dd>
  330. <dt><code>SYNTAX_1OP</code></dt>
  331. <dd><p>One Operand Instruction.
  332. </p>
  333. </dd>
  334. <dt><code>SYNTAX_NOP</code></dt>
  335. <dd><p>No Operand Instruction.
  336. </p></dd>
  337. </dl>
  338. <p>The syntax class may be followed by &lsquo;<samp>|</samp>&rsquo; and one of the following
  339. modifiers.
  340. </p><dl compact="compact">
  341. <dt><code>OP1_MUST_BE_IMM</code></dt>
  342. <dd><p>Modifies syntax class <code>SYNTAX_3OP</code>, specifying that the first
  343. operand of a three-operand instruction must be an immediate (i.e., the
  344. result is discarded). This is usually used to set the flags using
  345. specific instructions and not retain results.
  346. </p>
  347. </dd>
  348. <dt><code>OP1_IMM_IMPLIED</code></dt>
  349. <dd><p>Modifies syntax class <code>SYNTAX_20P</code>, specifying that there is an
  350. implied immediate destination operand which does not appear in the
  351. syntax.
  352. </p>
  353. <p>For example, if the source code contains an instruction like:
  354. </p><div class="example">
  355. <pre class="example">inst r1,r2
  356. </pre></div>
  357. <p>the first argument is an implied immediate (that is, the result is
  358. discarded). This is the same as though the source code were: inst
  359. 0,r1,r2.
  360. </p>
  361. </dd>
  362. </dl>
  363. <p>For example, defining a 64-bit multiplier with immediate operands:
  364. </p><div class="example">
  365. <pre class="example"> .extInstruction mp64, 0x07, 0x2d, SUFFIX_COND|SUFFIX_FLAG,
  366. SYNTAX_3OP|OP1_MUST_BE_IMM
  367. </pre></div>
  368. <p>which specifies an extension instruction named <code>mp64</code> with 3
  369. operands. It sets the flags and can be used with a condition code,
  370. for which the first operand is an immediate, i.e. equivalent to
  371. discarding the result of the operation.
  372. </p>
  373. <p>A two operands instruction variant would be:
  374. </p><div class="example">
  375. <pre class="example"> .extInstruction mul64, 0x07, 0x2d, SUFFIX_COND,
  376. SYNTAX_2OP|OP1_IMM_IMPLIED
  377. </pre></div>
  378. <p>which describes a two operand instruction with an implicit first
  379. immediate operand. The result of this operation would be discarded.
  380. </p>
  381. </dd>
  382. </dl>
  383. <hr>
  384. <div class="header">
  385. <p>
  386. Next: <a href="ARC-Modifiers.html#ARC-Modifiers" accesskey="n" rel="next">ARC Modifiers</a>, Previous: <a href="ARC-Syntax.html#ARC-Syntax" accesskey="p" rel="prev">ARC Syntax</a>, Up: <a href="ARC_002dDependent.html#ARC_002dDependent" accesskey="u" rel="up">ARC-Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  387. </div>
  388. </body>
  389. </html>