You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

304 lines
13KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>ARC Built-in Functions (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="ARC Built-in Functions (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="ARC Built-in Functions (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Target-Builtins.html#Target-Builtins" rel="up" title="Target Builtins">
  30. <link href="ARC-SIMD-Built_002din-Functions.html#ARC-SIMD-Built_002din-Functions" rel="next" title="ARC SIMD Built-in Functions">
  31. <link href="Altera-Nios-II-Built_002din-Functions.html#Altera-Nios-II-Built_002din-Functions" rel="prev" title="Altera Nios II Built-in Functions">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="ARC-Built_002din-Functions"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="ARC-SIMD-Built_002din-Functions.html#ARC-SIMD-Built_002din-Functions" accesskey="n" rel="next">ARC SIMD Built-in Functions</a>, Previous: <a href="Altera-Nios-II-Built_002din-Functions.html#Altera-Nios-II-Built_002din-Functions" accesskey="p" rel="prev">Altera Nios II Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="ARC-Built_002din-Functions-1"></a>
  68. <h4 class="subsection">6.60.4 ARC Built-in Functions</h4>
  69. <p>The following built-in functions are provided for ARC targets. The
  70. built-ins generate the corresponding assembly instructions. In the
  71. examples given below, the generated code often requires an operand or
  72. result to be in a register. Where necessary further code will be
  73. generated to ensure this is true, but for brevity this is not
  74. described in each case.
  75. </p>
  76. <p><em>Note:</em> Using a built-in to generate an instruction not supported
  77. by a target may cause problems. At present the compiler is not
  78. guaranteed to detect such misuse, and as a result an internal compiler
  79. error may be generated.
  80. </p>
  81. <dl>
  82. <dt><a name="index-_005f_005fbuiltin_005farc_005faligned"></a>Built-in Function: <em>int</em> <strong>__builtin_arc_aligned</strong> <em>(void *<var>val</var>, int <var>alignval</var>)</em></dt>
  83. <dd><p>Return 1 if <var>val</var> is known to have the byte alignment given
  84. by <var>alignval</var>, otherwise return 0.
  85. Note that this is different from
  86. </p><div class="smallexample">
  87. <pre class="smallexample">__alignof__(*(char *)<var>val</var>) &gt;= alignval
  88. </pre></div>
  89. <p>because __alignof__ sees only the type of the dereference, whereas
  90. __builtin_arc_align uses alignment information from the pointer
  91. as well as from the pointed-to type.
  92. The information available will depend on optimization level.
  93. </p></dd></dl>
  94. <dl>
  95. <dt><a name="index-_005f_005fbuiltin_005farc_005fbrk"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_brk</strong> <em>(void)</em></dt>
  96. <dd><p>Generates
  97. </p><div class="example">
  98. <pre class="example">brk
  99. </pre></div>
  100. </dd></dl>
  101. <dl>
  102. <dt><a name="index-_005f_005fbuiltin_005farc_005fcore_005fread"></a>Built-in Function: <em>unsigned int</em> <strong>__builtin_arc_core_read</strong> <em>(unsigned int <var>regno</var>)</em></dt>
  103. <dd><p>The operand is the number of a register to be read. Generates:
  104. </p><div class="example">
  105. <pre class="example">mov <var>dest</var>, r<var>regno</var>
  106. </pre></div>
  107. <p>where the value in <var>dest</var> will be the result returned from the
  108. built-in.
  109. </p></dd></dl>
  110. <dl>
  111. <dt><a name="index-_005f_005fbuiltin_005farc_005fcore_005fwrite"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_core_write</strong> <em>(unsigned int <var>regno</var>, unsigned int <var>val</var>)</em></dt>
  112. <dd><p>The first operand is the number of a register to be written, the
  113. second operand is a compile time constant to write into that
  114. register. Generates:
  115. </p><div class="example">
  116. <pre class="example">mov r<var>regno</var>, <var>val</var>
  117. </pre></div>
  118. </dd></dl>
  119. <dl>
  120. <dt><a name="index-_005f_005fbuiltin_005farc_005fdivaw"></a>Built-in Function: <em>int</em> <strong>__builtin_arc_divaw</strong> <em>(int <var>a</var>, int <var>b</var>)</em></dt>
  121. <dd><p>Only available if either <samp>-mcpu=ARC700</samp> or <samp>-meA</samp> is set.
  122. Generates:
  123. </p><div class="example">
  124. <pre class="example">divaw <var>dest</var>, <var>a</var>, <var>b</var>
  125. </pre></div>
  126. <p>where the value in <var>dest</var> will be the result returned from the
  127. built-in.
  128. </p></dd></dl>
  129. <dl>
  130. <dt><a name="index-_005f_005fbuiltin_005farc_005fflag"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_flag</strong> <em>(unsigned int <var>a</var>)</em></dt>
  131. <dd><p>Generates
  132. </p><div class="example">
  133. <pre class="example">flag <var>a</var>
  134. </pre></div>
  135. </dd></dl>
  136. <dl>
  137. <dt><a name="index-_005f_005fbuiltin_005farc_005flr"></a>Built-in Function: <em>unsigned int</em> <strong>__builtin_arc_lr</strong> <em>(unsigned int <var>auxr</var>)</em></dt>
  138. <dd><p>The operand, <var>auxv</var>, is the address of an auxiliary register and
  139. must be a compile time constant. Generates:
  140. </p><div class="example">
  141. <pre class="example">lr <var>dest</var>, [<var>auxr</var>]
  142. </pre></div>
  143. <p>Where the value in <var>dest</var> will be the result returned from the
  144. built-in.
  145. </p></dd></dl>
  146. <dl>
  147. <dt><a name="index-_005f_005fbuiltin_005farc_005fmul64"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_mul64</strong> <em>(int <var>a</var>, int <var>b</var>)</em></dt>
  148. <dd><p>Only available with <samp>-mmul64</samp>. Generates:
  149. </p><div class="example">
  150. <pre class="example">mul64 <var>a</var>, <var>b</var>
  151. </pre></div>
  152. </dd></dl>
  153. <dl>
  154. <dt><a name="index-_005f_005fbuiltin_005farc_005fmulu64"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_mulu64</strong> <em>(unsigned int <var>a</var>, unsigned int <var>b</var>)</em></dt>
  155. <dd><p>Only available with <samp>-mmul64</samp>. Generates:
  156. </p><div class="example">
  157. <pre class="example">mulu64 <var>a</var>, <var>b</var>
  158. </pre></div>
  159. </dd></dl>
  160. <dl>
  161. <dt><a name="index-_005f_005fbuiltin_005farc_005fnop"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_nop</strong> <em>(void)</em></dt>
  162. <dd><p>Generates:
  163. </p><div class="example">
  164. <pre class="example">nop
  165. </pre></div>
  166. </dd></dl>
  167. <dl>
  168. <dt><a name="index-_005f_005fbuiltin_005farc_005fnorm"></a>Built-in Function: <em>int</em> <strong>__builtin_arc_norm</strong> <em>(int <var>src</var>)</em></dt>
  169. <dd><p>Only valid if the &lsquo;<samp>norm</samp>&rsquo; instruction is available through the
  170. <samp>-mnorm</samp> option or by default with <samp>-mcpu=ARC700</samp>.
  171. Generates:
  172. </p><div class="example">
  173. <pre class="example">norm <var>dest</var>, <var>src</var>
  174. </pre></div>
  175. <p>Where the value in <var>dest</var> will be the result returned from the
  176. built-in.
  177. </p></dd></dl>
  178. <dl>
  179. <dt><a name="index-_005f_005fbuiltin_005farc_005fnormw"></a>Built-in Function: <em>short int</em> <strong>__builtin_arc_normw</strong> <em>(short int <var>src</var>)</em></dt>
  180. <dd><p>Only valid if the &lsquo;<samp>normw</samp>&rsquo; instruction is available through the
  181. <samp>-mnorm</samp> option or by default with <samp>-mcpu=ARC700</samp>.
  182. Generates:
  183. </p><div class="example">
  184. <pre class="example">normw <var>dest</var>, <var>src</var>
  185. </pre></div>
  186. <p>Where the value in <var>dest</var> will be the result returned from the
  187. built-in.
  188. </p></dd></dl>
  189. <dl>
  190. <dt><a name="index-_005f_005fbuiltin_005farc_005frtie"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_rtie</strong> <em>(void)</em></dt>
  191. <dd><p>Generates:
  192. </p><div class="example">
  193. <pre class="example">rtie
  194. </pre></div>
  195. </dd></dl>
  196. <dl>
  197. <dt><a name="index-_005f_005fbuiltin_005farc_005fsleep"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_sleep</strong> <em>(int <var>a</var></em></dt>
  198. <dd><p>Generates:
  199. </p><div class="example">
  200. <pre class="example">sleep <var>a</var>
  201. </pre></div>
  202. </dd></dl>
  203. <dl>
  204. <dt><a name="index-_005f_005fbuiltin_005farc_005fsr"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_sr</strong> <em>(unsigned int <var>auxr</var>, unsigned int <var>val</var>)</em></dt>
  205. <dd><p>The first argument, <var>auxv</var>, is the address of an auxiliary
  206. register, the second argument, <var>val</var>, is a compile time constant
  207. to be written to the register. Generates:
  208. </p><div class="example">
  209. <pre class="example">sr <var>auxr</var>, [<var>val</var>]
  210. </pre></div>
  211. </dd></dl>
  212. <dl>
  213. <dt><a name="index-_005f_005fbuiltin_005farc_005fswap"></a>Built-in Function: <em>int</em> <strong>__builtin_arc_swap</strong> <em>(int <var>src</var>)</em></dt>
  214. <dd><p>Only valid with <samp>-mswap</samp>. Generates:
  215. </p><div class="example">
  216. <pre class="example">swap <var>dest</var>, <var>src</var>
  217. </pre></div>
  218. <p>Where the value in <var>dest</var> will be the result returned from the
  219. built-in.
  220. </p></dd></dl>
  221. <dl>
  222. <dt><a name="index-_005f_005fbuiltin_005farc_005fswi"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_swi</strong> <em>(void)</em></dt>
  223. <dd><p>Generates:
  224. </p><div class="example">
  225. <pre class="example">swi
  226. </pre></div>
  227. </dd></dl>
  228. <dl>
  229. <dt><a name="index-_005f_005fbuiltin_005farc_005fsync"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_sync</strong> <em>(void)</em></dt>
  230. <dd><p>Only available with <samp>-mcpu=ARC700</samp>. Generates:
  231. </p><div class="example">
  232. <pre class="example">sync
  233. </pre></div>
  234. </dd></dl>
  235. <dl>
  236. <dt><a name="index-_005f_005fbuiltin_005farc_005ftrap_005fs"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_trap_s</strong> <em>(unsigned int <var>c</var>)</em></dt>
  237. <dd><p>Only available with <samp>-mcpu=ARC700</samp>. Generates:
  238. </p><div class="example">
  239. <pre class="example">trap_s <var>c</var>
  240. </pre></div>
  241. </dd></dl>
  242. <dl>
  243. <dt><a name="index-_005f_005fbuiltin_005farc_005funimp_005fs"></a>Built-in Function: <em>void</em> <strong>__builtin_arc_unimp_s</strong> <em>(void)</em></dt>
  244. <dd><p>Only available with <samp>-mcpu=ARC700</samp>. Generates:
  245. </p><div class="example">
  246. <pre class="example">unimp_s
  247. </pre></div>
  248. </dd></dl>
  249. <p>The instructions generated by the following builtins are not
  250. considered as candidates for scheduling. They are not moved around by
  251. the compiler during scheduling, and thus can be expected to appear
  252. where they are put in the C code:
  253. </p><div class="example">
  254. <pre class="example">__builtin_arc_brk()
  255. __builtin_arc_core_read()
  256. __builtin_arc_core_write()
  257. __builtin_arc_flag()
  258. __builtin_arc_lr()
  259. __builtin_arc_sleep()
  260. __builtin_arc_sr()
  261. __builtin_arc_swi()
  262. </pre></div>
  263. <hr>
  264. <div class="header">
  265. <p>
  266. Next: <a href="ARC-SIMD-Built_002din-Functions.html#ARC-SIMD-Built_002din-Functions" accesskey="n" rel="next">ARC SIMD Built-in Functions</a>, Previous: <a href="Altera-Nios-II-Built_002din-Functions.html#Altera-Nios-II-Built_002din-Functions" accesskey="p" rel="prev">Altera Nios II Built-in Functions</a>, Up: <a href="Target-Builtins.html#Target-Builtins" accesskey="u" rel="up">Target Builtins</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  267. </div>
  268. </body>
  269. </html>