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.

MIPS_002d3D-Built_002din-Functions.html 12KB

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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>MIPS-3D Built-in Functions (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="MIPS-3D Built-in Functions (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="MIPS-3D 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="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.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="MIPS_002d3D-Built_002din-Functions"></a>
  62. <div class="header">
  63. <p>
  64. 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>
  65. </div>
  66. <hr>
  67. <a name="MIPS_002d3D-Built_002din-Functions-1"></a>
  68. <h4 class="subsubsection">6.60.16.3 MIPS-3D Built-in Functions</h4>
  69. <p>The MIPS-3D Application-Specific Extension (ASE) includes additional
  70. paired-single instructions that are designed to improve the performance
  71. of 3D graphics operations. Support for these instructions is controlled
  72. by the <samp>-mips3d</samp> command-line option.
  73. </p>
  74. <p>The functions listed below map directly to a particular MIPS-3D
  75. instruction. Please refer to the architecture specification for
  76. more details on what each instruction does.
  77. </p>
  78. <dl compact="compact">
  79. <dt><code>v2sf __builtin_mips_addr_ps (v2sf, v2sf)</code></dt>
  80. <dd><p>Reduction add (<code>addr.ps</code>).
  81. </p>
  82. </dd>
  83. <dt><code>v2sf __builtin_mips_mulr_ps (v2sf, v2sf)</code></dt>
  84. <dd><p>Reduction multiply (<code>mulr.ps</code>).
  85. </p>
  86. </dd>
  87. <dt><code>v2sf __builtin_mips_cvt_pw_ps (v2sf)</code></dt>
  88. <dd><p>Convert paired single to paired word (<code>cvt.pw.ps</code>).
  89. </p>
  90. </dd>
  91. <dt><code>v2sf __builtin_mips_cvt_ps_pw (v2sf)</code></dt>
  92. <dd><p>Convert paired word to paired single (<code>cvt.ps.pw</code>).
  93. </p>
  94. </dd>
  95. <dt><code>float __builtin_mips_recip1_s (float)</code></dt>
  96. <dt><code>double __builtin_mips_recip1_d (double)</code></dt>
  97. <dt><code>v2sf __builtin_mips_recip1_ps (v2sf)</code></dt>
  98. <dd><p>Reduced-precision reciprocal (sequence step 1) (<code>recip1.<var>fmt</var></code>).
  99. </p>
  100. </dd>
  101. <dt><code>float __builtin_mips_recip2_s (float, float)</code></dt>
  102. <dt><code>double __builtin_mips_recip2_d (double, double)</code></dt>
  103. <dt><code>v2sf __builtin_mips_recip2_ps (v2sf, v2sf)</code></dt>
  104. <dd><p>Reduced-precision reciprocal (sequence step 2) (<code>recip2.<var>fmt</var></code>).
  105. </p>
  106. </dd>
  107. <dt><code>float __builtin_mips_rsqrt1_s (float)</code></dt>
  108. <dt><code>double __builtin_mips_rsqrt1_d (double)</code></dt>
  109. <dt><code>v2sf __builtin_mips_rsqrt1_ps (v2sf)</code></dt>
  110. <dd><p>Reduced-precision reciprocal square root (sequence step 1)
  111. (<code>rsqrt1.<var>fmt</var></code>).
  112. </p>
  113. </dd>
  114. <dt><code>float __builtin_mips_rsqrt2_s (float, float)</code></dt>
  115. <dt><code>double __builtin_mips_rsqrt2_d (double, double)</code></dt>
  116. <dt><code>v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf)</code></dt>
  117. <dd><p>Reduced-precision reciprocal square root (sequence step 2)
  118. (<code>rsqrt2.<var>fmt</var></code>).
  119. </p></dd>
  120. </dl>
  121. <p>The following multi-instruction functions are also available.
  122. In each case, <var>cond</var> can be any of the 16 floating-point conditions:
  123. <code>f</code>, <code>un</code>, <code>eq</code>, <code>ueq</code>, <code>olt</code>, <code>ult</code>,
  124. <code>ole</code>, <code>ule</code>, <code>sf</code>, <code>ngle</code>, <code>seq</code>,
  125. <code>ngl</code>, <code>lt</code>, <code>nge</code>, <code>le</code> or <code>ngt</code>.
  126. </p>
  127. <dl compact="compact">
  128. <dt><code>int __builtin_mips_cabs_<var>cond</var>_s (float <var>a</var>, float <var>b</var>)</code></dt>
  129. <dt><code>int __builtin_mips_cabs_<var>cond</var>_d (double <var>a</var>, double <var>b</var>)</code></dt>
  130. <dd><p>Absolute comparison of two scalar values (<code>cabs.<var>cond</var>.<var>fmt</var></code>,
  131. <code>bc1t</code>/<code>bc1f</code>).
  132. </p>
  133. <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.<var>cond</var>.s</code>
  134. or <code>cabs.<var>cond</var>.d</code> and return the result as a boolean value.
  135. For example:
  136. </p>
  137. <div class="smallexample">
  138. <pre class="smallexample">float a, b;
  139. if (__builtin_mips_cabs_eq_s (a, b))
  140. true ();
  141. else
  142. false ();
  143. </pre></div>
  144. </dd>
  145. <dt><code>int __builtin_mips_upper_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  146. <dt><code>int __builtin_mips_lower_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  147. <dd><p>Absolute comparison of two paired-single values (<code>cabs.<var>cond</var>.ps</code>,
  148. <code>bc1t</code>/<code>bc1f</code>).
  149. </p>
  150. <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.<var>cond</var>.ps</code>
  151. and return either the upper or lower half of the result. For example:
  152. </p>
  153. <div class="smallexample">
  154. <pre class="smallexample">v2sf a, b;
  155. if (__builtin_mips_upper_cabs_eq_ps (a, b))
  156. upper_halves_are_equal ();
  157. else
  158. upper_halves_are_unequal ();
  159. if (__builtin_mips_lower_cabs_eq_ps (a, b))
  160. lower_halves_are_equal ();
  161. else
  162. lower_halves_are_unequal ();
  163. </pre></div>
  164. </dd>
  165. <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>
  166. <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>
  167. <dd><p>Conditional move based on absolute comparison (<code>cabs.<var>cond</var>.ps</code>,
  168. <code>movt.ps</code>/<code>movf.ps</code>).
  169. </p>
  170. <p>The <code>movt</code> functions return the value <var>x</var> computed by:
  171. </p>
  172. <div class="smallexample">
  173. <pre class="smallexample">cabs.<var>cond</var>.ps <var>cc</var>,<var>a</var>,<var>b</var>
  174. mov.ps <var>x</var>,<var>c</var>
  175. movt.ps <var>x</var>,<var>d</var>,<var>cc</var>
  176. </pre></div>
  177. <p>The <code>movf</code> functions are similar but use <code>movf.ps</code> instead
  178. of <code>movt.ps</code>.
  179. </p>
  180. </dd>
  181. <dt><code>int __builtin_mips_any_c_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  182. <dt><code>int __builtin_mips_all_c_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  183. <dt><code>int __builtin_mips_any_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  184. <dt><code>int __builtin_mips_all_cabs_<var>cond</var>_ps (v2sf <var>a</var>, v2sf <var>b</var>)</code></dt>
  185. <dd><p>Comparison of two paired-single values
  186. (<code>c.<var>cond</var>.ps</code>/<code>cabs.<var>cond</var>.ps</code>,
  187. <code>bc1any2t</code>/<code>bc1any2f</code>).
  188. </p>
  189. <p>These functions compare <var>a</var> and <var>b</var> using <code>c.<var>cond</var>.ps</code>
  190. or <code>cabs.<var>cond</var>.ps</code>. The <code>any</code> forms return <code>true</code> if either
  191. result is <code>true</code> and the <code>all</code> forms return <code>true</code> if both results are <code>true</code>.
  192. For example:
  193. </p>
  194. <div class="smallexample">
  195. <pre class="smallexample">v2sf a, b;
  196. if (__builtin_mips_any_c_eq_ps (a, b))
  197. one_is_true ();
  198. else
  199. both_are_false ();
  200. if (__builtin_mips_all_c_eq_ps (a, b))
  201. both_are_true ();
  202. else
  203. one_is_false ();
  204. </pre></div>
  205. </dd>
  206. <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>
  207. <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>
  208. <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>
  209. <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>
  210. <dd><p>Comparison of four paired-single values
  211. (<code>c.<var>cond</var>.ps</code>/<code>cabs.<var>cond</var>.ps</code>,
  212. <code>bc1any4t</code>/<code>bc1any4f</code>).
  213. </p>
  214. <p>These functions use <code>c.<var>cond</var>.ps</code> or <code>cabs.<var>cond</var>.ps</code>
  215. to compare <var>a</var> with <var>b</var> and to compare <var>c</var> with <var>d</var>.
  216. The <code>any</code> forms return <code>true</code> if any of the four results are <code>true</code>
  217. and the <code>all</code> forms return <code>true</code> if all four results are <code>true</code>.
  218. For example:
  219. </p>
  220. <div class="smallexample">
  221. <pre class="smallexample">v2sf a, b, c, d;
  222. if (__builtin_mips_any_c_eq_4s (a, b, c, d))
  223. some_are_true ();
  224. else
  225. all_are_false ();
  226. if (__builtin_mips_all_c_eq_4s (a, b, c, d))
  227. all_are_true ();
  228. else
  229. some_are_false ();
  230. </pre></div>
  231. </dd>
  232. </dl>
  233. <hr>
  234. <div class="header">
  235. <p>
  236. 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>
  237. </div>
  238. </body>
  239. </html>