MIPS_002d3D-Built_002din-Functions.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>Using the GNU Compiler Collection (GCC): MIPS-3D Built-in Functions</title>
  20. <meta name="description" content="Using the GNU Compiler Collection (GCC): MIPS-3D Built-in Functions">
  21. <meta name="keywords" content="Using the GNU Compiler Collection (GCC): MIPS-3D Built-in Functions">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="MIPS-Loongson-Built_002din-Functions.html#MIPS-Loongson-Built_002din-Functions" rel="up" title="MIPS Loongson Built-in Functions">
  30. <link href="MIPS-SIMD-Architecture-_0028MSA_0029-Support.html#MIPS-SIMD-Architecture-_0028MSA_0029-Support" rel="next" title="MIPS SIMD Architecture (MSA) Support">
  31. <link href="Paired_002dSingle-Built_002din-Functions.html#Paired_002dSingle-Built_002din-Functions" rel="prev" title="Paired-Single Built-in Functions">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="MIPS_002d3D-Built_002din-Functions"></a>
  63. <div class="header">
  64. <p>
  65. Previous: <a href="Paired_002dSingle-Built_002din-Functions.html#Paired_002dSingle-Built_002din-Functions" accesskey="p" rel="prev">Paired-Single Built-in Functions</a>, Up: <a href="MIPS-Loongson-Built_002din-Functions.html#MIPS-Loongson-Built_002din-Functions" accesskey="u" rel="up">MIPS Loongson 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>
  66. </div>
  67. <hr>
  68. <a name="MIPS_002d3D-Built_002din-Functions-1"></a>
  69. <h4 class="subsubsection">6.60.15.3 MIPS-3D Built-in Functions</h4>
  70. <p>The MIPS-3D Application-Specific Extension (ASE) includes additional
  71. paired-single instructions that are designed to improve the performance
  72. of 3D graphics operations. Support for these instructions is controlled
  73. by the <samp>-mips3d</samp> command-line option.
  74. </p>
  75. <p>The functions listed below map directly to a particular MIPS-3D
  76. instruction. Please refer to the architecture specification for
  77. more details on what each instruction does.
  78. </p>
  79. <dl compact="compact">
  80. <dt><code>v2sf __builtin_mips_addr_ps (v2sf, v2sf)</code></dt>
  81. <dd><p>Reduction add (<code>addr.ps</code>).
  82. </p>
  83. </dd>
  84. <dt><code>v2sf __builtin_mips_mulr_ps (v2sf, v2sf)</code></dt>
  85. <dd><p>Reduction multiply (<code>mulr.ps</code>).
  86. </p>
  87. </dd>
  88. <dt><code>v2sf __builtin_mips_cvt_pw_ps (v2sf)</code></dt>
  89. <dd><p>Convert paired single to paired word (<code>cvt.pw.ps</code>).
  90. </p>
  91. </dd>
  92. <dt><code>v2sf __builtin_mips_cvt_ps_pw (v2sf)</code></dt>
  93. <dd><p>Convert paired word to paired single (<code>cvt.ps.pw</code>).
  94. </p>
  95. </dd>
  96. <dt><code>float __builtin_mips_recip1_s (float)</code></dt>
  97. <dt><code>double __builtin_mips_recip1_d (double)</code></dt>
  98. <dt><code>v2sf __builtin_mips_recip1_ps (v2sf)</code></dt>
  99. <dd><p>Reduced-precision reciprocal (sequence step 1) (<code>recip1.<var>fmt</var></code>).
  100. </p>
  101. </dd>
  102. <dt><code>float __builtin_mips_recip2_s (float, float)</code></dt>
  103. <dt><code>double __builtin_mips_recip2_d (double, double)</code></dt>
  104. <dt><code>v2sf __builtin_mips_recip2_ps (v2sf, v2sf)</code></dt>
  105. <dd><p>Reduced-precision reciprocal (sequence step 2) (<code>recip2.<var>fmt</var></code>).
  106. </p>
  107. </dd>
  108. <dt><code>float __builtin_mips_rsqrt1_s (float)</code></dt>
  109. <dt><code>double __builtin_mips_rsqrt1_d (double)</code></dt>
  110. <dt><code>v2sf __builtin_mips_rsqrt1_ps (v2sf)</code></dt>
  111. <dd><p>Reduced-precision reciprocal square root (sequence step 1)
  112. (<code>rsqrt1.<var>fmt</var></code>).
  113. </p>
  114. </dd>
  115. <dt><code>float __builtin_mips_rsqrt2_s (float, float)</code></dt>
  116. <dt><code>double __builtin_mips_rsqrt2_d (double, double)</code></dt>
  117. <dt><code>v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf)</code></dt>
  118. <dd><p>Reduced-precision reciprocal square root (sequence step 2)
  119. (<code>rsqrt2.<var>fmt</var></code>).
  120. </p></dd>
  121. </dl>
  122. <p>The following multi-instruction functions are also available.
  123. In each case, <var>cond</var> can be any of the 16 floating-point conditions:
  124. <code>f</code>, <code>un</code>, <code>eq</code>, <code>ueq</code>, <code>olt</code>, <code>ult</code>,
  125. <code>ole</code>, <code>ule</code>, <code>sf</code>, <code>ngle</code>, <code>seq</code>,
  126. <code>ngl</code>, <code>lt</code>, <code>nge</code>, <code>le</code> or <code>ngt</code>.
  127. </p>
  128. <dl compact="compact">
  129. <dt><code>int __builtin_mips_cabs_<var>cond</var>_s (float <var>a</var>, float <var>b</var>)</code></dt>
  130. <dt><code>int __builtin_mips_cabs_<var>cond</var>_d (double <var>a</var>, double <var>b</var>)</code></dt>
  131. <dd><p>Absolute comparison of two scalar values (<code>cabs.<var>cond</var>.<var>fmt</var></code>,
  132. <code>bc1t</code>/<code>bc1f</code>).
  133. </p>
  134. <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.<var>cond</var>.s</code>
  135. or <code>cabs.<var>cond</var>.d</code> and return the result as a boolean value.
  136. For example:
  137. </p>
  138. <div class="smallexample">
  139. <pre class="smallexample">float a, b;
  140. if (__builtin_mips_cabs_eq_s (a, b))
  141. true ();
  142. else
  143. false ();
  144. </pre></div>
  145. </dd>
  146. <dt><code>int __builtin_mips_upper_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  147. <dt><code>int __builtin_mips_lower_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  148. <dd><p>Absolute comparison of two paired-single values (<code>cabs.<var>cond</var>.ps</code>,
  149. <code>bc1t</code>/<code>bc1f</code>).
  150. </p>
  151. <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.<var>cond</var>.ps</code>
  152. and return either the upper or lower half of the result. For example:
  153. </p>
  154. <div class="smallexample">
  155. <pre class="smallexample">v2sf a, b;
  156. if (__builtin_mips_upper_cabs_eq_ps (a, b))
  157. upper_halves_are_equal ();
  158. else
  159. upper_halves_are_unequal ();
  160. if (__builtin_mips_lower_cabs_eq_ps (a, b))
  161. lower_halves_are_equal ();
  162. else
  163. lower_halves_are_unequal ();
  164. </pre></div>
  165. </dd>
  166. <dt><code>v2sf __builtin_mips_movt_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  167. <dt><code>v2sf __builtin_mips_movf_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  168. <dd><p>Conditional move based on absolute comparison (<code>cabs.<var>cond</var>.ps</code>,
  169. <code>movt.ps</code>/<code>movf.ps</code>).
  170. </p>
  171. <p>The <code>movt</code> functions return the value <var>x</var> computed by:
  172. </p>
  173. <div class="smallexample">
  174. <pre class="smallexample">cabs.<var>cond</var>.ps <var>cc</var>,<var>a</var>,<var>b</var>
  175. mov.ps <var>x</var>,<var>c</var>
  176. movt.ps <var>x</var>,<var>d</var>,<var>cc</var>
  177. </pre></div>
  178. <p>The <code>movf</code> functions are similar but use <code>movf.ps</code> instead
  179. of <code>movt.ps</code>.
  180. </p>
  181. </dd>
  182. <dt><code>int __builtin_mips_any_c_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  183. <dt><code>int __builtin_mips_all_c_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  184. <dt><code>int __builtin_mips_any_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  185. <dt><code>int __builtin_mips_all_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  186. <dd><p>Comparison of two paired-single values
  187. (<code>c.<var>cond</var>.ps</code>/<code>cabs.<var>cond</var>.ps</code>,
  188. <code>bc1any2t</code>/<code>bc1any2f</code>).
  189. </p>
  190. <p>These functions compare <var>a</var> and <var>b</var> using <code>c.<var>cond</var>.ps</code>
  191. or <code>cabs.<var>cond</var>.ps</code>. The <code>any</code> forms return true if either
  192. result is true and the <code>all</code> forms return true if both results are true.
  193. For example:
  194. </p>
  195. <div class="smallexample">
  196. <pre class="smallexample">v2sf a, b;
  197. if (__builtin_mips_any_c_eq_ps (a, b))
  198. one_is_true ();
  199. else
  200. both_are_false ();
  201. if (__builtin_mips_all_c_eq_ps (a, b))
  202. both_are_true ();
  203. else
  204. one_is_false ();
  205. </pre></div>
  206. </dd>
  207. <dt><code>int __builtin_mips_any_c_<var>cond</var>_4s (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  208. <dt><code>int __builtin_mips_all_c_<var>cond</var>_4s (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  209. <dt><code>int __builtin_mips_any_cabs_<var>cond</var>_4s (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  210. <dt><code>int __builtin_mips_all_cabs_<var>cond</var>_4s (v2sf <var>a</var>, v2sf <var>b</var>, v2sf <var>c</var>, v2sf <var>d</var>)</code></dt>
  211. <dd><p>Comparison of four paired-single values
  212. (<code>c.<var>cond</var>.ps</code>/<code>cabs.<var>cond</var>.ps</code>,
  213. <code>bc1any4t</code>/<code>bc1any4f</code>).
  214. </p>
  215. <p>These functions use <code>c.<var>cond</var>.ps</code> or <code>cabs.<var>cond</var>.ps</code>
  216. to compare <var>a</var> with <var>b</var> and to compare <var>c</var> with <var>d</var>.
  217. The <code>any</code> forms return true if any of the four results are true
  218. and the <code>all</code> forms return true if all four results are true.
  219. For example:
  220. </p>
  221. <div class="smallexample">
  222. <pre class="smallexample">v2sf a, b, c, d;
  223. if (__builtin_mips_any_c_eq_4s (a, b, c, d))
  224. some_are_true ();
  225. else
  226. all_are_false ();
  227. if (__builtin_mips_all_c_eq_4s (a, b, c, d))
  228. all_are_true ();
  229. else
  230. some_are_false ();
  231. </pre></div>
  232. </dd>
  233. </dl>
  234. <hr>
  235. <div class="header">
  236. <p>
  237. Previous: <a href="Paired_002dSingle-Built_002din-Functions.html#Paired_002dSingle-Built_002din-Functions" accesskey="p" rel="prev">Paired-Single Built-in Functions</a>, Up: <a href="MIPS-Loongson-Built_002din-Functions.html#MIPS-Loongson-Built_002din-Functions" accesskey="u" rel="up">MIPS Loongson 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>
  238. </div>
  239. </body>
  240. </html>