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.

PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-3_002e0.html 40KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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>PowerPC AltiVec Built-in Functions Available on ISA 3.0 (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="PowerPC AltiVec Built-in Functions Available on ISA 3.0 (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="PowerPC AltiVec Built-in Functions Available on ISA 3.0 (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="PowerPC-AltiVec_002fVSX-Built_002din-Functions.html#PowerPC-AltiVec_002fVSX-Built_002din-Functions" rel="up" title="PowerPC AltiVec/VSX Built-in Functions">
  30. <link href="PowerPC-Hardware-Transactional-Memory-Built_002din-Functions.html#PowerPC-Hardware-Transactional-Memory-Built_002din-Functions" rel="next" title="PowerPC Hardware Transactional Memory Built-in Functions">
  31. <link href="PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07.html#PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07" rel="prev" title="PowerPC AltiVec Built-in Functions Available on ISA 2.07">
  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="PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-3_002e0"></a>
  62. <div class="header">
  63. <p>
  64. Previous: <a href="PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07.html#PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Up: <a href="PowerPC-AltiVec_002fVSX-Built_002din-Functions.html#PowerPC-AltiVec_002fVSX-Built_002din-Functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</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="PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-3_002e0-1"></a>
  68. <h4 class="subsubsection">6.60.23.4 PowerPC AltiVec Built-in Functions Available on ISA 3.0</h4>
  69. <p>The following additional built-in functions are also available for the
  70. PowerPC family of processors, starting with ISA 3.0
  71. (<samp>-mcpu=power9</samp>) or later:
  72. </p><div class="smallexample">
  73. <pre class="smallexample">unsigned int scalar_extract_exp (double source);
  74. unsigned long long int scalar_extract_exp (__ieee128 source);
  75. unsigned long long int scalar_extract_sig (double source);
  76. unsigned __int128 scalar_extract_sig (__ieee128 source);
  77. double scalar_insert_exp (unsigned long long int significand,
  78. unsigned long long int exponent);
  79. double scalar_insert_exp (double significand, unsigned long long int exponent);
  80. ieee_128 scalar_insert_exp (unsigned __int128 significand,
  81. unsigned long long int exponent);
  82. ieee_128 scalar_insert_exp (ieee_128 significand, unsigned long long int exponent);
  83. int scalar_cmp_exp_gt (double arg1, double arg2);
  84. int scalar_cmp_exp_lt (double arg1, double arg2);
  85. int scalar_cmp_exp_eq (double arg1, double arg2);
  86. int scalar_cmp_exp_unordered (double arg1, double arg2);
  87. bool scalar_test_data_class (float source, const int condition);
  88. bool scalar_test_data_class (double source, const int condition);
  89. bool scalar_test_data_class (__ieee128 source, const int condition);
  90. bool scalar_test_neg (float source);
  91. bool scalar_test_neg (double source);
  92. bool scalar_test_neg (__ieee128 source);
  93. vector _uint128_t vec_msum (vector unsigned long long,
  94. vector unsigned long long,
  95. vector _uint128_t);
  96. vector _int128_t vec_msum (vector signed long long,
  97. vector signed long long,
  98. vector _int128_t);
  99. </pre></div>
  100. <p>The <code>scalar_extract_exp</code> and <code>scalar_extract_sig</code>
  101. functions require a 64-bit environment supporting ISA 3.0 or later.
  102. The <code>scalar_extract_exp</code> and <code>scalar_extract_sig</code> built-in
  103. functions return the significand and the biased exponent value
  104. respectively of their <code>source</code> arguments.
  105. When supplied with a 64-bit <code>source</code> argument, the
  106. result returned by <code>scalar_extract_sig</code> has
  107. the <code>0x0010000000000000</code> bit set if the
  108. function&rsquo;s <code>source</code> argument is in normalized form.
  109. Otherwise, this bit is set to 0.
  110. When supplied with a 128-bit <code>source</code> argument, the
  111. <code>0x00010000000000000000000000000000</code> bit of the result is
  112. treated similarly.
  113. Note that the sign of the significand is not represented in the result
  114. returned from the <code>scalar_extract_sig</code> function. Use the
  115. <code>scalar_test_neg</code> function to test the sign of its <code>double</code>
  116. argument.
  117. The <code>vec_msum</code> functions perform a vector multiply-sum, returning
  118. the result of arg1*arg2+arg3. ISA 3.0 adds support for vec_msum returning
  119. a vector int128 result.
  120. </p>
  121. <p>The <code>scalar_insert_exp</code>
  122. functions require a 64-bit environment supporting ISA 3.0 or later.
  123. When supplied with a 64-bit first argument, the
  124. <code>scalar_insert_exp</code> built-in function returns a double-precision
  125. floating point value that is constructed by assembling the values of its
  126. <code>significand</code> and <code>exponent</code> arguments. The sign of the
  127. result is copied from the most significant bit of the
  128. <code>significand</code> argument. The significand and exponent components
  129. of the result are composed of the least significant 11 bits of the
  130. <code>exponent</code> argument and the least significant 52 bits of the
  131. <code>significand</code> argument respectively.
  132. </p>
  133. <p>When supplied with a 128-bit first argument, the
  134. <code>scalar_insert_exp</code> built-in function returns a quad-precision
  135. ieee floating point value. The sign bit of the result is copied from
  136. the most significant bit of the <code>significand</code> argument.
  137. The significand and exponent components of the result are composed of
  138. the least significant 15 bits of the <code>exponent</code> argument and the
  139. least significant 112 bits of the <code>significand</code> argument respectively.
  140. </p>
  141. <p>The <code>scalar_cmp_exp_gt</code>, <code>scalar_cmp_exp_lt</code>,
  142. <code>scalar_cmp_exp_eq</code>, and <code>scalar_cmp_exp_unordered</code> built-in
  143. functions return a non-zero value if <code>arg1</code> is greater than, less
  144. than, equal to, or not comparable to <code>arg2</code> respectively. The
  145. arguments are not comparable if one or the other equals NaN (not a
  146. number).
  147. </p>
  148. <p>The <code>scalar_test_data_class</code> built-in function returns 1
  149. if any of the condition tests enabled by the value of the
  150. <code>condition</code> variable are true, and 0 otherwise. The
  151. <code>condition</code> argument must be a compile-time constant integer with
  152. value not exceeding 127. The
  153. <code>condition</code> argument is encoded as a bitmask with each bit
  154. enabling the testing of a different condition, as characterized by the
  155. following:
  156. </p><div class="smallexample">
  157. <pre class="smallexample">0x40 Test for NaN
  158. 0x20 Test for +Infinity
  159. 0x10 Test for -Infinity
  160. 0x08 Test for +Zero
  161. 0x04 Test for -Zero
  162. 0x02 Test for +Denormal
  163. 0x01 Test for -Denormal
  164. </pre></div>
  165. <p>The <code>scalar_test_neg</code> built-in function returns 1 if its
  166. <code>source</code> argument holds a negative value, 0 otherwise.
  167. </p>
  168. <p>The following built-in functions are also available for the PowerPC family
  169. of processors, starting with ISA 3.0 or later
  170. (<samp>-mcpu=power9</samp>). These string functions are described
  171. separately in order to group the descriptions closer to the function
  172. prototypes:
  173. </p><div class="smallexample">
  174. <pre class="smallexample">int vec_all_nez (vector signed char, vector signed char);
  175. int vec_all_nez (vector unsigned char, vector unsigned char);
  176. int vec_all_nez (vector signed short, vector signed short);
  177. int vec_all_nez (vector unsigned short, vector unsigned short);
  178. int vec_all_nez (vector signed int, vector signed int);
  179. int vec_all_nez (vector unsigned int, vector unsigned int);
  180. int vec_any_eqz (vector signed char, vector signed char);
  181. int vec_any_eqz (vector unsigned char, vector unsigned char);
  182. int vec_any_eqz (vector signed short, vector signed short);
  183. int vec_any_eqz (vector unsigned short, vector unsigned short);
  184. int vec_any_eqz (vector signed int, vector signed int);
  185. int vec_any_eqz (vector unsigned int, vector unsigned int);
  186. vector bool char vec_cmpnez (vector signed char arg1, vector signed char arg2);
  187. vector bool char vec_cmpnez (vector unsigned char arg1, vector unsigned char arg2);
  188. vector bool short vec_cmpnez (vector signed short arg1, vector signed short arg2);
  189. vector bool short vec_cmpnez (vector unsigned short arg1, vector unsigned short arg2);
  190. vector bool int vec_cmpnez (vector signed int arg1, vector signed int arg2);
  191. vector bool int vec_cmpnez (vector unsigned int, vector unsigned int);
  192. vector signed char vec_cnttz (vector signed char);
  193. vector unsigned char vec_cnttz (vector unsigned char);
  194. vector signed short vec_cnttz (vector signed short);
  195. vector unsigned short vec_cnttz (vector unsigned short);
  196. vector signed int vec_cnttz (vector signed int);
  197. vector unsigned int vec_cnttz (vector unsigned int);
  198. vector signed long long vec_cnttz (vector signed long long);
  199. vector unsigned long long vec_cnttz (vector unsigned long long);
  200. signed int vec_cntlz_lsbb (vector signed char);
  201. signed int vec_cntlz_lsbb (vector unsigned char);
  202. signed int vec_cnttz_lsbb (vector signed char);
  203. signed int vec_cnttz_lsbb (vector unsigned char);
  204. unsigned int vec_first_match_index (vector signed char, vector signed char);
  205. unsigned int vec_first_match_index (vector unsigned char, vector unsigned char);
  206. unsigned int vec_first_match_index (vector signed int, vector signed int);
  207. unsigned int vec_first_match_index (vector unsigned int, vector unsigned int);
  208. unsigned int vec_first_match_index (vector signed short, vector signed short);
  209. unsigned int vec_first_match_index (vector unsigned short, vector unsigned short);
  210. unsigned int vec_first_match_or_eos_index (vector signed char, vector signed char);
  211. unsigned int vec_first_match_or_eos_index (vector unsigned char, vector unsigned char);
  212. unsigned int vec_first_match_or_eos_index (vector signed int, vector signed int);
  213. unsigned int vec_first_match_or_eos_index (vector unsigned int, vector unsigned int);
  214. unsigned int vec_first_match_or_eos_index (vector signed short, vector signed short);
  215. unsigned int vec_first_match_or_eos_index (vector unsigned short,
  216. vector unsigned short);
  217. unsigned int vec_first_mismatch_index (vector signed char, vector signed char);
  218. unsigned int vec_first_mismatch_index (vector unsigned char, vector unsigned char);
  219. unsigned int vec_first_mismatch_index (vector signed int, vector signed int);
  220. unsigned int vec_first_mismatch_index (vector unsigned int, vector unsigned int);
  221. unsigned int vec_first_mismatch_index (vector signed short, vector signed short);
  222. unsigned int vec_first_mismatch_index (vector unsigned short, vector unsigned short);
  223. unsigned int vec_first_mismatch_or_eos_index (vector signed char, vector signed char);
  224. unsigned int vec_first_mismatch_or_eos_index (vector unsigned char,
  225. vector unsigned char);
  226. unsigned int vec_first_mismatch_or_eos_index (vector signed int, vector signed int);
  227. unsigned int vec_first_mismatch_or_eos_index (vector unsigned int, vector unsigned int);
  228. unsigned int vec_first_mismatch_or_eos_index (vector signed short, vector signed short);
  229. unsigned int vec_first_mismatch_or_eos_index (vector unsigned short,
  230. vector unsigned short);
  231. vector unsigned short vec_pack_to_short_fp32 (vector float, vector float);
  232. vector signed char vec_xl_be (signed long long, signed char *);
  233. vector unsigned char vec_xl_be (signed long long, unsigned char *);
  234. vector signed int vec_xl_be (signed long long, signed int *);
  235. vector unsigned int vec_xl_be (signed long long, unsigned int *);
  236. vector signed __int128 vec_xl_be (signed long long, signed __int128 *);
  237. vector unsigned __int128 vec_xl_be (signed long long, unsigned __int128 *);
  238. vector signed long long vec_xl_be (signed long long, signed long long *);
  239. vector unsigned long long vec_xl_be (signed long long, unsigned long long *);
  240. vector signed short vec_xl_be (signed long long, signed short *);
  241. vector unsigned short vec_xl_be (signed long long, unsigned short *);
  242. vector double vec_xl_be (signed long long, double *);
  243. vector float vec_xl_be (signed long long, float *);
  244. vector signed char vec_xl_len (signed char *addr, size_t len);
  245. vector unsigned char vec_xl_len (unsigned char *addr, size_t len);
  246. vector signed int vec_xl_len (signed int *addr, size_t len);
  247. vector unsigned int vec_xl_len (unsigned int *addr, size_t len);
  248. vector signed __int128 vec_xl_len (signed __int128 *addr, size_t len);
  249. vector unsigned __int128 vec_xl_len (unsigned __int128 *addr, size_t len);
  250. vector signed long long vec_xl_len (signed long long *addr, size_t len);
  251. vector unsigned long long vec_xl_len (unsigned long long *addr, size_t len);
  252. vector signed short vec_xl_len (signed short *addr, size_t len);
  253. vector unsigned short vec_xl_len (unsigned short *addr, size_t len);
  254. vector double vec_xl_len (double *addr, size_t len);
  255. vector float vec_xl_len (float *addr, size_t len);
  256. vector unsigned char vec_xl_len_r (unsigned char *addr, size_t len);
  257. void vec_xst_len (vector signed char data, signed char *addr, size_t len);
  258. void vec_xst_len (vector unsigned char data, unsigned char *addr, size_t len);
  259. void vec_xst_len (vector signed int data, signed int *addr, size_t len);
  260. void vec_xst_len (vector unsigned int data, unsigned int *addr, size_t len);
  261. void vec_xst_len (vector unsigned __int128 data, unsigned __int128 *addr, size_t len);
  262. void vec_xst_len (vector signed long long data, signed long long *addr, size_t len);
  263. void vec_xst_len (vector unsigned long long data, unsigned long long *addr, size_t len);
  264. void vec_xst_len (vector signed short data, signed short *addr, size_t len);
  265. void vec_xst_len (vector unsigned short data, unsigned short *addr, size_t len);
  266. void vec_xst_len (vector signed __int128 data, signed __int128 *addr, size_t len);
  267. void vec_xst_len (vector double data, double *addr, size_t len);
  268. void vec_xst_len (vector float data, float *addr, size_t len);
  269. void vec_xst_len_r (vector unsigned char data, unsigned char *addr, size_t len);
  270. signed char vec_xlx (unsigned int index, vector signed char data);
  271. unsigned char vec_xlx (unsigned int index, vector unsigned char data);
  272. signed short vec_xlx (unsigned int index, vector signed short data);
  273. unsigned short vec_xlx (unsigned int index, vector unsigned short data);
  274. signed int vec_xlx (unsigned int index, vector signed int data);
  275. unsigned int vec_xlx (unsigned int index, vector unsigned int data);
  276. float vec_xlx (unsigned int index, vector float data);
  277. signed char vec_xrx (unsigned int index, vector signed char data);
  278. unsigned char vec_xrx (unsigned int index, vector unsigned char data);
  279. signed short vec_xrx (unsigned int index, vector signed short data);
  280. unsigned short vec_xrx (unsigned int index, vector unsigned short data);
  281. signed int vec_xrx (unsigned int index, vector signed int data);
  282. unsigned int vec_xrx (unsigned int index, vector unsigned int data);
  283. float vec_xrx (unsigned int index, vector float data);
  284. </pre></div>
  285. <p>The <code>vec_all_nez</code>, <code>vec_any_eqz</code>, and <code>vec_cmpnez</code>
  286. perform pairwise comparisons between the elements at the same
  287. positions within their two vector arguments.
  288. The <code>vec_all_nez</code> function returns a
  289. non-zero value if and only if all pairwise comparisons are not
  290. equal and no element of either vector argument contains a zero.
  291. The <code>vec_any_eqz</code> function returns a
  292. non-zero value if and only if at least one pairwise comparison is equal
  293. or if at least one element of either vector argument contains a zero.
  294. The <code>vec_cmpnez</code> function returns a vector of the same type as
  295. its two arguments, within which each element consists of all ones to
  296. denote that either the corresponding elements of the incoming arguments are
  297. not equal or that at least one of the corresponding elements contains
  298. zero. Otherwise, the element of the returned vector contains all zeros.
  299. </p>
  300. <p>The <code>vec_cntlz_lsbb</code> function returns the count of the number of
  301. consecutive leading byte elements (starting from position 0 within the
  302. supplied vector argument) for which the least-significant bit
  303. equals zero. The <code>vec_cnttz_lsbb</code> function returns the count of
  304. the number of consecutive trailing byte elements (starting from
  305. position 15 and counting backwards within the supplied vector
  306. argument) for which the least-significant bit equals zero.
  307. </p>
  308. <p>The <code>vec_xl_len</code> and <code>vec_xst_len</code> functions require a
  309. 64-bit environment supporting ISA 3.0 or later. The <code>vec_xl_len</code>
  310. function loads a variable length vector from memory. The
  311. <code>vec_xst_len</code> function stores a variable length vector to memory.
  312. With both the <code>vec_xl_len</code> and <code>vec_xst_len</code> functions, the
  313. <code>addr</code> argument represents the memory address to or from which
  314. data will be transferred, and the
  315. <code>len</code> argument represents the number of bytes to be
  316. transferred, as computed by the C expression <code>min((len &amp; 0xff), 16)</code>.
  317. If this expression&rsquo;s value is not a multiple of the vector element&rsquo;s
  318. size, the behavior of this function is undefined.
  319. In the case that the underlying computer is configured to run in
  320. big-endian mode, the data transfer moves bytes 0 to <code>(len - 1)</code> of
  321. the corresponding vector. In little-endian mode, the data transfer
  322. moves bytes <code>(16 - len)</code> to <code>15</code> of the corresponding
  323. vector. For the load function, any bytes of the result vector that
  324. are not loaded from memory are set to zero.
  325. The value of the <code>addr</code> argument need not be aligned on a
  326. multiple of the vector&rsquo;s element size.
  327. </p>
  328. <p>The <code>vec_xlx</code> and <code>vec_xrx</code> functions extract the single
  329. element selected by the <code>index</code> argument from the vector
  330. represented by the <code>data</code> argument. The <code>index</code> argument
  331. always specifies a byte offset, regardless of the size of the vector
  332. element. With <code>vec_xlx</code>, <code>index</code> is the offset of the first
  333. byte of the element to be extracted. With <code>vec_xrx</code>, <code>index</code>
  334. represents the last byte of the element to be extracted, measured
  335. from the right end of the vector. In other words, the last byte of
  336. the element to be extracted is found at position <code>(15 - index)</code>.
  337. There is no requirement that <code>index</code> be a multiple of the vector
  338. element size. However, if the size of the vector element added to
  339. <code>index</code> is greater than 15, the content of the returned value is
  340. undefined.
  341. </p>
  342. <p>If the ISA 3.0 instruction set additions (<samp>-mcpu=power9</samp>)
  343. are available:
  344. </p>
  345. <div class="smallexample">
  346. <pre class="smallexample">vector unsigned long long vec_bperm (vector unsigned long long, vector unsigned char);
  347. vector bool char vec_cmpne (vector bool char, vector bool char);
  348. vector bool char vec_cmpne (vector signed char, vector signed char);
  349. vector bool char vec_cmpne (vector unsigned char, vector unsigned char);
  350. vector bool int vec_cmpne (vector bool int, vector bool int);
  351. vector bool int vec_cmpne (vector signed int, vector signed int);
  352. vector bool int vec_cmpne (vector unsigned int, vector unsigned int);
  353. vector bool long long vec_cmpne (vector bool long long, vector bool long long);
  354. vector bool long long vec_cmpne (vector signed long long, vector signed long long);
  355. vector bool long long vec_cmpne (vector unsigned long long, vector unsigned long long);
  356. vector bool short vec_cmpne (vector bool short, vector bool short);
  357. vector bool short vec_cmpne (vector signed short, vector signed short);
  358. vector bool short vec_cmpne (vector unsigned short, vector unsigned short);
  359. vector bool long long vec_cmpne (vector double, vector double);
  360. vector bool int vec_cmpne (vector float, vector float);
  361. vector float vec_extract_fp32_from_shorth (vector unsigned short);
  362. vector float vec_extract_fp32_from_shortl (vector unsigned short);
  363. vector long long vec_vctz (vector long long);
  364. vector unsigned long long vec_vctz (vector unsigned long long);
  365. vector int vec_vctz (vector int);
  366. vector unsigned int vec_vctz (vector int);
  367. vector short vec_vctz (vector short);
  368. vector unsigned short vec_vctz (vector unsigned short);
  369. vector signed char vec_vctz (vector signed char);
  370. vector unsigned char vec_vctz (vector unsigned char);
  371. vector signed char vec_vctzb (vector signed char);
  372. vector unsigned char vec_vctzb (vector unsigned char);
  373. vector long long vec_vctzd (vector long long);
  374. vector unsigned long long vec_vctzd (vector unsigned long long);
  375. vector short vec_vctzh (vector short);
  376. vector unsigned short vec_vctzh (vector unsigned short);
  377. vector int vec_vctzw (vector int);
  378. vector unsigned int vec_vctzw (vector int);
  379. vector unsigned long long vec_extract4b (vector unsigned char, const int);
  380. vector unsigned char vec_insert4b (vector signed int, vector unsigned char,
  381. const int);
  382. vector unsigned char vec_insert4b (vector unsigned int, vector unsigned char,
  383. const int);
  384. vector unsigned int vec_parity_lsbb (vector signed int);
  385. vector unsigned int vec_parity_lsbb (vector unsigned int);
  386. vector unsigned __int128 vec_parity_lsbb (vector signed __int128);
  387. vector unsigned __int128 vec_parity_lsbb (vector unsigned __int128);
  388. vector unsigned long long vec_parity_lsbb (vector signed long long);
  389. vector unsigned long long vec_parity_lsbb (vector unsigned long long);
  390. vector int vec_vprtyb (vector int);
  391. vector unsigned int vec_vprtyb (vector unsigned int);
  392. vector long long vec_vprtyb (vector long long);
  393. vector unsigned long long vec_vprtyb (vector unsigned long long);
  394. vector int vec_vprtybw (vector int);
  395. vector unsigned int vec_vprtybw (vector unsigned int);
  396. vector long long vec_vprtybd (vector long long);
  397. vector unsigned long long vec_vprtybd (vector unsigned long long);
  398. </pre></div>
  399. <p>On 64-bit targets, if the ISA 3.0 additions (<samp>-mcpu=power9</samp>)
  400. are available:
  401. </p>
  402. <div class="smallexample">
  403. <pre class="smallexample">vector long vec_vprtyb (vector long);
  404. vector unsigned long vec_vprtyb (vector unsigned long);
  405. vector __int128 vec_vprtyb (vector __int128);
  406. vector __uint128 vec_vprtyb (vector __uint128);
  407. vector long vec_vprtybd (vector long);
  408. vector unsigned long vec_vprtybd (vector unsigned long);
  409. vector __int128 vec_vprtybq (vector __int128);
  410. vector __uint128 vec_vprtybd (vector __uint128);
  411. </pre></div>
  412. <p>The following built-in vector functions are available for the PowerPC family
  413. of processors, starting with ISA 3.0 or later (<samp>-mcpu=power9</samp>):
  414. </p><div class="smallexample">
  415. <pre class="smallexample">__vector unsigned char
  416. vec_slv (__vector unsigned char src, __vector unsigned char shift_distance);
  417. __vector unsigned char
  418. vec_srv (__vector unsigned char src, __vector unsigned char shift_distance);
  419. </pre></div>
  420. <p>The <code>vec_slv</code> and <code>vec_srv</code> functions operate on
  421. all of the bytes of their <code>src</code> and <code>shift_distance</code>
  422. arguments in parallel. The behavior of the <code>vec_slv</code> is as if
  423. there existed a temporary array of 17 unsigned characters
  424. <code>slv_array</code> within which elements 0 through 15 are the same as
  425. the entries in the <code>src</code> array and element 16 equals 0. The
  426. result returned from the <code>vec_slv</code> function is a
  427. <code>__vector</code> of 16 unsigned characters within which element
  428. <code>i</code> is computed using the C expression
  429. <code>0xff &amp; (*((unsigned short *)(slv_array + i)) &lt;&lt; (0x07 &amp;
  430. shift_distance[i]))</code>,
  431. with this resulting value coerced to the <code>unsigned char</code> type.
  432. The behavior of the <code>vec_srv</code> is as if
  433. there existed a temporary array of 17 unsigned characters
  434. <code>srv_array</code> within which element 0 equals zero and
  435. elements 1 through 16 equal the elements 0 through 15 of
  436. the <code>src</code> array. The
  437. result returned from the <code>vec_srv</code> function is a
  438. <code>__vector</code> of 16 unsigned characters within which element
  439. <code>i</code> is computed using the C expression
  440. <code>0xff &amp; (*((unsigned short *)(srv_array + i)) &gt;&gt;
  441. (0x07 &amp; shift_distance[i]))</code>,
  442. with this resulting value coerced to the <code>unsigned char</code> type.
  443. </p>
  444. <p>The following built-in functions are available for the PowerPC family
  445. of processors, starting with ISA 3.0 or later (<samp>-mcpu=power9</samp>):
  446. </p><div class="smallexample">
  447. <pre class="smallexample">__vector unsigned char
  448. vec_absd (__vector unsigned char arg1, __vector unsigned char arg2);
  449. __vector unsigned short
  450. vec_absd (__vector unsigned short arg1, __vector unsigned short arg2);
  451. __vector unsigned int
  452. vec_absd (__vector unsigned int arg1, __vector unsigned int arg2);
  453. __vector unsigned char
  454. vec_absdb (__vector unsigned char arg1, __vector unsigned char arg2);
  455. __vector unsigned short
  456. vec_absdh (__vector unsigned short arg1, __vector unsigned short arg2);
  457. __vector unsigned int
  458. vec_absdw (__vector unsigned int arg1, __vector unsigned int arg2);
  459. </pre></div>
  460. <p>The <code>vec_absd</code>, <code>vec_absdb</code>, <code>vec_absdh</code>, and
  461. <code>vec_absdw</code> built-in functions each computes the absolute
  462. differences of the pairs of vector elements supplied in its two vector
  463. arguments, placing the absolute differences into the corresponding
  464. elements of the vector result.
  465. </p>
  466. <p>The following built-in functions are available for the PowerPC family
  467. of processors, starting with ISA 3.0 or later (<samp>-mcpu=power9</samp>):
  468. </p><div class="smallexample">
  469. <pre class="smallexample">__vector unsigned int vec_extract_exp (__vector float source);
  470. __vector unsigned long long int vec_extract_exp (__vector double source);
  471. __vector unsigned int vec_extract_sig (__vector float source);
  472. __vector unsigned long long int vec_extract_sig (__vector double source);
  473. __vector float vec_insert_exp (__vector unsigned int significands,
  474. __vector unsigned int exponents);
  475. __vector float vec_insert_exp (__vector unsigned float significands,
  476. __vector unsigned int exponents);
  477. __vector double vec_insert_exp (__vector unsigned long long int significands,
  478. __vector unsigned long long int exponents);
  479. __vector double vec_insert_exp (__vector unsigned double significands,
  480. __vector unsigned long long int exponents);
  481. __vector bool int vec_test_data_class (__vector float source, const int condition);
  482. __vector bool long long int vec_test_data_class (__vector double source,
  483. const int condition);
  484. </pre></div>
  485. <p>The <code>vec_extract_sig</code> and <code>vec_extract_exp</code> built-in
  486. functions return vectors representing the significands and biased
  487. exponent values of their <code>source</code> arguments respectively.
  488. Within the result vector returned by <code>vec_extract_sig</code>, the
  489. <code>0x800000</code> bit of each vector element returned when the
  490. function&rsquo;s <code>source</code> argument is of type <code>float</code> is set to 1
  491. if the corresponding floating point value is in normalized form.
  492. Otherwise, this bit is set to 0. When the <code>source</code> argument is
  493. of type <code>double</code>, the <code>0x10000000000000</code> bit within each of
  494. the result vector&rsquo;s elements is set according to the same rules.
  495. Note that the sign of the significand is not represented in the result
  496. returned from the <code>vec_extract_sig</code> function. To extract the
  497. sign bits, use the
  498. <code>vec_cpsgn</code> function, which returns a new vector within which all
  499. of the sign bits of its second argument vector are overwritten with the
  500. sign bits copied from the coresponding elements of its first argument
  501. vector, and all other (non-sign) bits of the second argument vector
  502. are copied unchanged into the result vector.
  503. </p>
  504. <p>The <code>vec_insert_exp</code> built-in functions return a vector of
  505. single- or double-precision floating
  506. point values constructed by assembling the values of their
  507. <code>significands</code> and <code>exponents</code> arguments into the
  508. corresponding elements of the returned vector.
  509. The sign of each
  510. element of the result is copied from the most significant bit of the
  511. corresponding entry within the <code>significands</code> argument.
  512. Note that the relevant
  513. bits of the <code>significands</code> argument are the same, for both integer
  514. and floating point types.
  515. The
  516. significand and exponent components of each element of the result are
  517. composed of the least significant bits of the corresponding
  518. <code>significands</code> element and the least significant bits of the
  519. corresponding <code>exponents</code> element.
  520. </p>
  521. <p>The <code>vec_test_data_class</code> built-in function returns a vector
  522. representing the results of testing the <code>source</code> vector for the
  523. condition selected by the <code>condition</code> argument. The
  524. <code>condition</code> argument must be a compile-time constant integer with
  525. value not exceeding 127. The
  526. <code>condition</code> argument is encoded as a bitmask with each bit
  527. enabling the testing of a different condition, as characterized by the
  528. following:
  529. </p><div class="smallexample">
  530. <pre class="smallexample">0x40 Test for NaN
  531. 0x20 Test for +Infinity
  532. 0x10 Test for -Infinity
  533. 0x08 Test for +Zero
  534. 0x04 Test for -Zero
  535. 0x02 Test for +Denormal
  536. 0x01 Test for -Denormal
  537. </pre></div>
  538. <p>If any of the enabled test conditions is true, the corresponding entry
  539. in the result vector is -1. Otherwise (all of the enabled test
  540. conditions are false), the corresponding entry of the result vector is 0.
  541. </p>
  542. <p>The following built-in functions are available for the PowerPC family
  543. of processors, starting with ISA 3.0 or later (<samp>-mcpu=power9</samp>):
  544. </p><div class="smallexample">
  545. <pre class="smallexample">vector unsigned int vec_rlmi (vector unsigned int, vector unsigned int,
  546. vector unsigned int);
  547. vector unsigned long long vec_rlmi (vector unsigned long long,
  548. vector unsigned long long,
  549. vector unsigned long long);
  550. vector unsigned int vec_rlnm (vector unsigned int, vector unsigned int,
  551. vector unsigned int);
  552. vector unsigned long long vec_rlnm (vector unsigned long long,
  553. vector unsigned long long,
  554. vector unsigned long long);
  555. vector unsigned int vec_vrlnm (vector unsigned int, vector unsigned int);
  556. vector unsigned long long vec_vrlnm (vector unsigned long long,
  557. vector unsigned long long);
  558. </pre></div>
  559. <p>The result of <code>vec_rlmi</code> is obtained by rotating each element of
  560. the first argument vector left and inserting it under mask into the
  561. second argument vector. The third argument vector contains the mask
  562. beginning in bits 11:15, the mask end in bits 19:23, and the shift
  563. count in bits 27:31, of each element.
  564. </p>
  565. <p>The result of <code>vec_rlnm</code> is obtained by rotating each element of
  566. the first argument vector left and ANDing it with a mask specified by
  567. the second and third argument vectors. The second argument vector
  568. contains the shift count for each element in the low-order byte. The
  569. third argument vector contains the mask end for each element in the
  570. low-order byte, with the mask begin in the next higher byte.
  571. </p>
  572. <p>The result of <code>vec_vrlnm</code> is obtained by rotating each element
  573. of the first argument vector left and ANDing it with a mask. The
  574. second argument vector contains the mask beginning in bits 11:15,
  575. the mask end in bits 19:23, and the shift count in bits 27:31,
  576. of each element.
  577. </p>
  578. <p>If the ISA 3.0 instruction set additions (<samp>-mcpu=power9</samp>)
  579. are available:
  580. </p><div class="smallexample">
  581. <pre class="smallexample">vector signed bool char vec_revb (vector signed char);
  582. vector signed char vec_revb (vector signed char);
  583. vector unsigned char vec_revb (vector unsigned char);
  584. vector bool short vec_revb (vector bool short);
  585. vector short vec_revb (vector short);
  586. vector unsigned short vec_revb (vector unsigned short);
  587. vector bool int vec_revb (vector bool int);
  588. vector int vec_revb (vector int);
  589. vector unsigned int vec_revb (vector unsigned int);
  590. vector float vec_revb (vector float);
  591. vector bool long long vec_revb (vector bool long long);
  592. vector long long vec_revb (vector long long);
  593. vector unsigned long long vec_revb (vector unsigned long long);
  594. vector double vec_revb (vector double);
  595. </pre></div>
  596. <p>On 64-bit targets, if the ISA 3.0 additions (<samp>-mcpu=power9</samp>)
  597. are available:
  598. </p><div class="smallexample">
  599. <pre class="smallexample">vector long vec_revb (vector long);
  600. vector unsigned long vec_revb (vector unsigned long);
  601. vector __int128 vec_revb (vector __int128);
  602. vector __uint128 vec_revb (vector __uint128);
  603. </pre></div>
  604. <p>The <code>vec_revb</code> built-in function reverses the bytes on an element
  605. by element basis. A vector of <code>vector unsigned char</code> or
  606. <code>vector signed char</code> reverses the bytes in the whole word.
  607. </p>
  608. <p>If the cryptographic instructions are enabled (<samp>-mcrypto</samp> or
  609. <samp>-mcpu=power8</samp>), the following builtins are enabled.
  610. </p>
  611. <div class="smallexample">
  612. <pre class="smallexample">vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long);
  613. vector unsigned char vec_sbox_be (vector unsigned char);
  614. vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long,
  615. vector unsigned long long);
  616. vector unsigned char vec_cipher_be (vector unsigned char, vector unsigned char);
  617. vector unsigned long long __builtin_crypto_vcipherlast
  618. (vector unsigned long long,
  619. vector unsigned long long);
  620. vector unsigned char vec_cipherlast_be (vector unsigned char,
  621. vector unsigned char);
  622. vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long,
  623. vector unsigned long long);
  624. vector unsigned char vec_ncipher_be (vector unsigned char,
  625. vector unsigned char);
  626. vector unsigned long long __builtin_crypto_vncipherlast (vector unsigned long long,
  627. vector unsigned long long);
  628. vector unsigned char vec_ncipherlast_be (vector unsigned char,
  629. vector unsigned char);
  630. vector unsigned char __builtin_crypto_vpermxor (vector unsigned char,
  631. vector unsigned char,
  632. vector unsigned char);
  633. vector unsigned short __builtin_crypto_vpermxor (vector unsigned short,
  634. vector unsigned short,
  635. vector unsigned short);
  636. vector unsigned int __builtin_crypto_vpermxor (vector unsigned int,
  637. vector unsigned int,
  638. vector unsigned int);
  639. vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long,
  640. vector unsigned long long,
  641. vector unsigned long long);
  642. vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char,
  643. vector unsigned char);
  644. vector unsigned short __builtin_crypto_vpmsumh (vector unsigned short,
  645. vector unsigned short);
  646. vector unsigned int __builtin_crypto_vpmsumw (vector unsigned int,
  647. vector unsigned int);
  648. vector unsigned long long __builtin_crypto_vpmsumd (vector unsigned long long,
  649. vector unsigned long long);
  650. vector unsigned long long __builtin_crypto_vshasigmad (vector unsigned long long,
  651. int, int);
  652. vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int, int, int);
  653. </pre></div>
  654. <p>The second argument to <var>__builtin_crypto_vshasigmad</var> and
  655. <var>__builtin_crypto_vshasigmaw</var> must be a constant
  656. integer that is 0 or 1. The third argument to these built-in functions
  657. must be a constant integer in the range of 0 to 15.
  658. </p>
  659. <p>If the ISA 3.0 instruction set additions
  660. are enabled (<samp>-mcpu=power9</samp>), the following additional
  661. functions are available for both 32-bit and 64-bit targets.
  662. </p><div class="smallexample">
  663. <pre class="smallexample">vector short vec_xl (int, vector short *);
  664. vector short vec_xl (int, short *);
  665. vector unsigned short vec_xl (int, vector unsigned short *);
  666. vector unsigned short vec_xl (int, unsigned short *);
  667. vector char vec_xl (int, vector char *);
  668. vector char vec_xl (int, char *);
  669. vector unsigned char vec_xl (int, vector unsigned char *);
  670. vector unsigned char vec_xl (int, unsigned char *);
  671. void vec_xst (vector short, int, vector short *);
  672. void vec_xst (vector short, int, short *);
  673. void vec_xst (vector unsigned short, int, vector unsigned short *);
  674. void vec_xst (vector unsigned short, int, unsigned short *);
  675. void vec_xst (vector char, int, vector char *);
  676. void vec_xst (vector char, int, char *);
  677. void vec_xst (vector unsigned char, int, vector unsigned char *);
  678. void vec_xst (vector unsigned char, int, unsigned char *);
  679. </pre></div>
  680. <hr>
  681. <div class="header">
  682. <p>
  683. Previous: <a href="PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07.html#PowerPC-AltiVec-Built_002din-Functions-Available-on-ISA-2_002e07" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Up: <a href="PowerPC-AltiVec_002fVSX-Built_002din-Functions.html#PowerPC-AltiVec_002fVSX-Built_002din-Functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</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>
  684. </div>
  685. </body>
  686. </html>