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.

312 lines
14KB

  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 SIMD Built-in Functions (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="ARC SIMD Built-in Functions (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="ARC SIMD 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="ARM-iWMMXt-Built_002din-Functions.html#ARM-iWMMXt-Built_002din-Functions" rel="next" title="ARM iWMMXt Built-in Functions">
  31. <link href="ARC-Built_002din-Functions.html#ARC-Built_002din-Functions" rel="prev" title="ARC 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-SIMD-Built_002din-Functions"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="ARM-iWMMXt-Built_002din-Functions.html#ARM-iWMMXt-Built_002din-Functions" accesskey="n" rel="next">ARM iWMMXt Built-in Functions</a>, Previous: <a href="ARC-Built_002din-Functions.html#ARC-Built_002din-Functions" accesskey="p" rel="prev">ARC 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-SIMD-Built_002din-Functions-1"></a>
  68. <h4 class="subsection">6.60.5 ARC SIMD Built-in Functions</h4>
  69. <p>SIMD builtins provided by the compiler can be used to generate the
  70. vector instructions. This section describes the available builtins
  71. and their usage in programs. With the <samp>-msimd</samp> option, the
  72. compiler provides 128-bit vector types, which can be specified using
  73. the <code>vector_size</code> attribute. The header file <samp>arc-simd.h</samp>
  74. can be included to use the following predefined types:
  75. </p><div class="example">
  76. <pre class="example">typedef int __v4si __attribute__((vector_size(16)));
  77. typedef short __v8hi __attribute__((vector_size(16)));
  78. </pre></div>
  79. <p>These types can be used to define 128-bit variables. The built-in
  80. functions listed in the following section can be used on these
  81. variables to generate the vector operations.
  82. </p>
  83. <p>For all builtins, <code>__builtin_arc_<var>someinsn</var></code>, the header file
  84. <samp>arc-simd.h</samp> also provides equivalent macros called
  85. <code>_<var>someinsn</var></code> that can be used for programming ease and
  86. improved readability. The following macros for DMA control are also
  87. provided:
  88. </p><div class="example">
  89. <pre class="example">#define _setup_dma_in_channel_reg _vdiwr
  90. #define _setup_dma_out_channel_reg _vdowr
  91. </pre></div>
  92. <p>The following is a complete list of all the SIMD built-ins provided
  93. for ARC, grouped by calling signature.
  94. </p>
  95. <p>The following take two <code>__v8hi</code> arguments and return a
  96. <code>__v8hi</code> result:
  97. </p><div class="example">
  98. <pre class="example">__v8hi __builtin_arc_vaddaw (__v8hi, __v8hi)
  99. __v8hi __builtin_arc_vaddw (__v8hi, __v8hi)
  100. __v8hi __builtin_arc_vand (__v8hi, __v8hi)
  101. __v8hi __builtin_arc_vandaw (__v8hi, __v8hi)
  102. __v8hi __builtin_arc_vavb (__v8hi, __v8hi)
  103. __v8hi __builtin_arc_vavrb (__v8hi, __v8hi)
  104. __v8hi __builtin_arc_vbic (__v8hi, __v8hi)
  105. __v8hi __builtin_arc_vbicaw (__v8hi, __v8hi)
  106. __v8hi __builtin_arc_vdifaw (__v8hi, __v8hi)
  107. __v8hi __builtin_arc_vdifw (__v8hi, __v8hi)
  108. __v8hi __builtin_arc_veqw (__v8hi, __v8hi)
  109. __v8hi __builtin_arc_vh264f (__v8hi, __v8hi)
  110. __v8hi __builtin_arc_vh264ft (__v8hi, __v8hi)
  111. __v8hi __builtin_arc_vh264fw (__v8hi, __v8hi)
  112. __v8hi __builtin_arc_vlew (__v8hi, __v8hi)
  113. __v8hi __builtin_arc_vltw (__v8hi, __v8hi)
  114. __v8hi __builtin_arc_vmaxaw (__v8hi, __v8hi)
  115. __v8hi __builtin_arc_vmaxw (__v8hi, __v8hi)
  116. __v8hi __builtin_arc_vminaw (__v8hi, __v8hi)
  117. __v8hi __builtin_arc_vminw (__v8hi, __v8hi)
  118. __v8hi __builtin_arc_vmr1aw (__v8hi, __v8hi)
  119. __v8hi __builtin_arc_vmr1w (__v8hi, __v8hi)
  120. __v8hi __builtin_arc_vmr2aw (__v8hi, __v8hi)
  121. __v8hi __builtin_arc_vmr2w (__v8hi, __v8hi)
  122. __v8hi __builtin_arc_vmr3aw (__v8hi, __v8hi)
  123. __v8hi __builtin_arc_vmr3w (__v8hi, __v8hi)
  124. __v8hi __builtin_arc_vmr4aw (__v8hi, __v8hi)
  125. __v8hi __builtin_arc_vmr4w (__v8hi, __v8hi)
  126. __v8hi __builtin_arc_vmr5aw (__v8hi, __v8hi)
  127. __v8hi __builtin_arc_vmr5w (__v8hi, __v8hi)
  128. __v8hi __builtin_arc_vmr6aw (__v8hi, __v8hi)
  129. __v8hi __builtin_arc_vmr6w (__v8hi, __v8hi)
  130. __v8hi __builtin_arc_vmr7aw (__v8hi, __v8hi)
  131. __v8hi __builtin_arc_vmr7w (__v8hi, __v8hi)
  132. __v8hi __builtin_arc_vmrb (__v8hi, __v8hi)
  133. __v8hi __builtin_arc_vmulaw (__v8hi, __v8hi)
  134. __v8hi __builtin_arc_vmulfaw (__v8hi, __v8hi)
  135. __v8hi __builtin_arc_vmulfw (__v8hi, __v8hi)
  136. __v8hi __builtin_arc_vmulw (__v8hi, __v8hi)
  137. __v8hi __builtin_arc_vnew (__v8hi, __v8hi)
  138. __v8hi __builtin_arc_vor (__v8hi, __v8hi)
  139. __v8hi __builtin_arc_vsubaw (__v8hi, __v8hi)
  140. __v8hi __builtin_arc_vsubw (__v8hi, __v8hi)
  141. __v8hi __builtin_arc_vsummw (__v8hi, __v8hi)
  142. __v8hi __builtin_arc_vvc1f (__v8hi, __v8hi)
  143. __v8hi __builtin_arc_vvc1ft (__v8hi, __v8hi)
  144. __v8hi __builtin_arc_vxor (__v8hi, __v8hi)
  145. __v8hi __builtin_arc_vxoraw (__v8hi, __v8hi)
  146. </pre></div>
  147. <p>The following take one <code>__v8hi</code> and one <code>int</code> argument and return a
  148. <code>__v8hi</code> result:
  149. </p>
  150. <div class="example">
  151. <pre class="example">__v8hi __builtin_arc_vbaddw (__v8hi, int)
  152. __v8hi __builtin_arc_vbmaxw (__v8hi, int)
  153. __v8hi __builtin_arc_vbminw (__v8hi, int)
  154. __v8hi __builtin_arc_vbmulaw (__v8hi, int)
  155. __v8hi __builtin_arc_vbmulfw (__v8hi, int)
  156. __v8hi __builtin_arc_vbmulw (__v8hi, int)
  157. __v8hi __builtin_arc_vbrsubw (__v8hi, int)
  158. __v8hi __builtin_arc_vbsubw (__v8hi, int)
  159. </pre></div>
  160. <p>The following take one <code>__v8hi</code> argument and one <code>int</code> argument which
  161. must be a 3-bit compile time constant indicating a register number
  162. I0-I7. They return a <code>__v8hi</code> result.
  163. </p><div class="example">
  164. <pre class="example">__v8hi __builtin_arc_vasrw (__v8hi, const int)
  165. __v8hi __builtin_arc_vsr8 (__v8hi, const int)
  166. __v8hi __builtin_arc_vsr8aw (__v8hi, const int)
  167. </pre></div>
  168. <p>The following take one <code>__v8hi</code> argument and one <code>int</code>
  169. argument which must be a 6-bit compile time constant. They return a
  170. <code>__v8hi</code> result.
  171. </p><div class="example">
  172. <pre class="example">__v8hi __builtin_arc_vasrpwbi (__v8hi, const int)
  173. __v8hi __builtin_arc_vasrrpwbi (__v8hi, const int)
  174. __v8hi __builtin_arc_vasrrwi (__v8hi, const int)
  175. __v8hi __builtin_arc_vasrsrwi (__v8hi, const int)
  176. __v8hi __builtin_arc_vasrwi (__v8hi, const int)
  177. __v8hi __builtin_arc_vsr8awi (__v8hi, const int)
  178. __v8hi __builtin_arc_vsr8i (__v8hi, const int)
  179. </pre></div>
  180. <p>The following take one <code>__v8hi</code> argument and one <code>int</code> argument which
  181. must be a 8-bit compile time constant. They return a <code>__v8hi</code>
  182. result.
  183. </p><div class="example">
  184. <pre class="example">__v8hi __builtin_arc_vd6tapf (__v8hi, const int)
  185. __v8hi __builtin_arc_vmvaw (__v8hi, const int)
  186. __v8hi __builtin_arc_vmvw (__v8hi, const int)
  187. __v8hi __builtin_arc_vmvzw (__v8hi, const int)
  188. </pre></div>
  189. <p>The following take two <code>int</code> arguments, the second of which which
  190. must be a 8-bit compile time constant. They return a <code>__v8hi</code>
  191. result:
  192. </p><div class="example">
  193. <pre class="example">__v8hi __builtin_arc_vmovaw (int, const int)
  194. __v8hi __builtin_arc_vmovw (int, const int)
  195. __v8hi __builtin_arc_vmovzw (int, const int)
  196. </pre></div>
  197. <p>The following take a single <code>__v8hi</code> argument and return a
  198. <code>__v8hi</code> result:
  199. </p><div class="example">
  200. <pre class="example">__v8hi __builtin_arc_vabsaw (__v8hi)
  201. __v8hi __builtin_arc_vabsw (__v8hi)
  202. __v8hi __builtin_arc_vaddsuw (__v8hi)
  203. __v8hi __builtin_arc_vexch1 (__v8hi)
  204. __v8hi __builtin_arc_vexch2 (__v8hi)
  205. __v8hi __builtin_arc_vexch4 (__v8hi)
  206. __v8hi __builtin_arc_vsignw (__v8hi)
  207. __v8hi __builtin_arc_vupbaw (__v8hi)
  208. __v8hi __builtin_arc_vupbw (__v8hi)
  209. __v8hi __builtin_arc_vupsbaw (__v8hi)
  210. __v8hi __builtin_arc_vupsbw (__v8hi)
  211. </pre></div>
  212. <p>The following take two <code>int</code> arguments and return no result:
  213. </p><div class="example">
  214. <pre class="example">void __builtin_arc_vdirun (int, int)
  215. void __builtin_arc_vdorun (int, int)
  216. </pre></div>
  217. <p>The following take two <code>int</code> arguments and return no result. The
  218. first argument must a 3-bit compile time constant indicating one of
  219. the DR0-DR7 DMA setup channels:
  220. </p><div class="example">
  221. <pre class="example">void __builtin_arc_vdiwr (const int, int)
  222. void __builtin_arc_vdowr (const int, int)
  223. </pre></div>
  224. <p>The following take an <code>int</code> argument and return no result:
  225. </p><div class="example">
  226. <pre class="example">void __builtin_arc_vendrec (int)
  227. void __builtin_arc_vrec (int)
  228. void __builtin_arc_vrecrun (int)
  229. void __builtin_arc_vrun (int)
  230. </pre></div>
  231. <p>The following take a <code>__v8hi</code> argument and two <code>int</code>
  232. arguments and return a <code>__v8hi</code> result. The second argument must
  233. be a 3-bit compile time constants, indicating one the registers I0-I7,
  234. and the third argument must be an 8-bit compile time constant.
  235. </p>
  236. <p><em>Note:</em> Although the equivalent hardware instructions do not take
  237. an SIMD register as an operand, these builtins overwrite the relevant
  238. bits of the <code>__v8hi</code> register provided as the first argument with
  239. the value loaded from the <code>[Ib, u8]</code> location in the SDM.
  240. </p>
  241. <div class="example">
  242. <pre class="example">__v8hi __builtin_arc_vld32 (__v8hi, const int, const int)
  243. __v8hi __builtin_arc_vld32wh (__v8hi, const int, const int)
  244. __v8hi __builtin_arc_vld32wl (__v8hi, const int, const int)
  245. __v8hi __builtin_arc_vld64 (__v8hi, const int, const int)
  246. </pre></div>
  247. <p>The following take two <code>int</code> arguments and return a <code>__v8hi</code>
  248. result. The first argument must be a 3-bit compile time constants,
  249. indicating one the registers I0-I7, and the second argument must be an
  250. 8-bit compile time constant.
  251. </p>
  252. <div class="example">
  253. <pre class="example">__v8hi __builtin_arc_vld128 (const int, const int)
  254. __v8hi __builtin_arc_vld64w (const int, const int)
  255. </pre></div>
  256. <p>The following take a <code>__v8hi</code> argument and two <code>int</code>
  257. arguments and return no result. The second argument must be a 3-bit
  258. compile time constants, indicating one the registers I0-I7, and the
  259. third argument must be an 8-bit compile time constant.
  260. </p>
  261. <div class="example">
  262. <pre class="example">void __builtin_arc_vst128 (__v8hi, const int, const int)
  263. void __builtin_arc_vst64 (__v8hi, const int, const int)
  264. </pre></div>
  265. <p>The following take a <code>__v8hi</code> argument and three <code>int</code>
  266. arguments and return no result. The second argument must be a 3-bit
  267. compile-time constant, identifying the 16-bit sub-register to be
  268. stored, the third argument must be a 3-bit compile time constants,
  269. indicating one the registers I0-I7, and the fourth argument must be an
  270. 8-bit compile time constant.
  271. </p>
  272. <div class="example">
  273. <pre class="example">void __builtin_arc_vst16_n (__v8hi, const int, const int, const int)
  274. void __builtin_arc_vst32_n (__v8hi, const int, const int, const int)
  275. </pre></div>
  276. <hr>
  277. <div class="header">
  278. <p>
  279. Next: <a href="ARM-iWMMXt-Built_002din-Functions.html#ARM-iWMMXt-Built_002din-Functions" accesskey="n" rel="next">ARM iWMMXt Built-in Functions</a>, Previous: <a href="ARC-Built_002din-Functions.html#ARC-Built_002din-Functions" accesskey="p" rel="prev">ARC 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>
  280. </div>
  281. </body>
  282. </html>