選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

424 行
15KB

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