1<html lang="en"> 2<head> 3<title>MIPS-3D Built-in Functions - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="MIPS-Loongson-Built_002din-Functions.html#MIPS-Loongson-Built_002din-Functions" title="MIPS Loongson Built-in Functions"> 9<link rel="prev" href="Paired_002dSingle-Built_002din-Functions.html#Paired_002dSingle-Built_002din-Functions" title="Paired-Single Built-in Functions"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 142010 Free Software Foundation, Inc. 15 16Permission is granted to copy, distribute and/or modify this document 17under the terms of the GNU Free Documentation License, Version 1.3 or 18any later version published by the Free Software Foundation; with the 19Invariant Sections being ``Funding Free Software'', the Front-Cover 20Texts being (a) (see below), and with the Back-Cover Texts being (b) 21(see below). A copy of the license is included in the section entitled 22``GNU Free Documentation License''. 23 24(a) The FSF's Front-Cover Text is: 25 26 A GNU Manual 27 28(b) The FSF's Back-Cover Text is: 29 30 You have freedom to copy and modify this GNU Manual, like GNU 31 software. Copies published by the Free Software Foundation raise 32 funds for GNU development.--> 33<meta http-equiv="Content-Style-Type" content="text/css"> 34<style type="text/css"><!-- 35 pre.display { font-family:inherit } 36 pre.format { font-family:inherit } 37 pre.smalldisplay { font-family:inherit; font-size:smaller } 38 pre.smallformat { font-family:inherit; font-size:smaller } 39 pre.smallexample { font-size:smaller } 40 pre.smalllisp { font-size:smaller } 41 span.sc { font-variant:small-caps } 42 span.roman { font-family:serif; font-weight:normal; } 43 span.sansserif { font-family:sans-serif; font-weight:normal; } 44--></style> 45<link rel="stylesheet" type="text/css" href="../cs.css"> 46</head> 47<body> 48<div class="node"> 49<a name="MIPS-3D-Built-in-Functions"></a> 50<a name="MIPS_002d3D-Built_002din-Functions"></a> 51<p> 52Previous: <a rel="previous" accesskey="p" href="Paired_002dSingle-Built_002din-Functions.html#Paired_002dSingle-Built_002din-Functions">Paired-Single Built-in Functions</a>, 53Up: <a rel="up" accesskey="u" href="MIPS-Loongson-Built_002din-Functions.html#MIPS-Loongson-Built_002din-Functions">MIPS Loongson Built-in Functions</a> 54<hr> 55</div> 56 57<h5 class="subsubsection">6.54.9.3 MIPS-3D Built-in Functions</h5> 58 59<p>The MIPS-3D Application-Specific Extension (ASE) includes additional 60paired-single instructions that are designed to improve the performance 61of 3D graphics operations. Support for these instructions is controlled 62by the <samp><span class="option">-mips3d</span></samp> command-line option. 63 64 <p>The functions listed below map directly to a particular MIPS-3D 65instruction. Please refer to the architecture specification for 66more details on what each instruction does. 67 68 <dl> 69<dt><code>v2sf __builtin_mips_addr_ps (v2sf, v2sf)</code><dd>Reduction add (<code>addr.ps</code>). 70 71 <br><dt><code>v2sf __builtin_mips_mulr_ps (v2sf, v2sf)</code><dd>Reduction multiply (<code>mulr.ps</code>). 72 73 <br><dt><code>v2sf __builtin_mips_cvt_pw_ps (v2sf)</code><dd>Convert paired single to paired word (<code>cvt.pw.ps</code>). 74 75 <br><dt><code>v2sf __builtin_mips_cvt_ps_pw (v2sf)</code><dd>Convert paired word to paired single (<code>cvt.ps.pw</code>). 76 77 <br><dt><code>float __builtin_mips_recip1_s (float)</code><dt><code>double __builtin_mips_recip1_d (double)</code><dt><code>v2sf __builtin_mips_recip1_ps (v2sf)</code><dd>Reduced precision reciprocal (sequence step 1) (<code>recip1.</code><var>fmt</var>). 78 79 <br><dt><code>float __builtin_mips_recip2_s (float, float)</code><dt><code>double __builtin_mips_recip2_d (double, double)</code><dt><code>v2sf __builtin_mips_recip2_ps (v2sf, v2sf)</code><dd>Reduced precision reciprocal (sequence step 2) (<code>recip2.</code><var>fmt</var>). 80 81 <br><dt><code>float __builtin_mips_rsqrt1_s (float)</code><dt><code>double __builtin_mips_rsqrt1_d (double)</code><dt><code>v2sf __builtin_mips_rsqrt1_ps (v2sf)</code><dd>Reduced precision reciprocal square root (sequence step 1) 82(<code>rsqrt1.</code><var>fmt</var>). 83 84 <br><dt><code>float __builtin_mips_rsqrt2_s (float, float)</code><dt><code>double __builtin_mips_rsqrt2_d (double, double)</code><dt><code>v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf)</code><dd>Reduced precision reciprocal square root (sequence step 2) 85(<code>rsqrt2.</code><var>fmt</var>). 86</dl> 87 88 <p>The following multi-instruction functions are also available. 89In each case, <var>cond</var> can be any of the 16 floating-point conditions: 90<code>f</code>, <code>un</code>, <code>eq</code>, <code>ueq</code>, <code>olt</code>, <code>ult</code>, 91<code>ole</code>, <code>ule</code>, <code>sf</code>, <code>ngle</code>, <code>seq</code>, 92<code>ngl</code>, <code>lt</code>, <code>nge</code>, <code>le</code> or <code>ngt</code>. 93 94 <dl> 95<dt><code>int __builtin_mips_cabs_</code><var>cond</var><code>_s (float </code><var>a</var><code>, float </code><var>b</var><code>)</code><dt><code>int __builtin_mips_cabs_</code><var>cond</var><code>_d (double </code><var>a</var><code>, double </code><var>b</var><code>)</code><dd>Absolute comparison of two scalar values (<code>cabs.</code><var>cond</var><code>.</code><var>fmt</var>, 96<code>bc1t</code>/<code>bc1f</code>). 97 98 <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.</code><var>cond</var><code>.s</code> 99or <code>cabs.</code><var>cond</var><code>.d</code> and return the result as a boolean value. 100For example: 101 102 <pre class="smallexample"> float a, b; 103 if (__builtin_mips_cabs_eq_s (a, b)) 104 true (); 105 else 106 false (); 107</pre> 108 <br><dt><code>int __builtin_mips_upper_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dt><code>int __builtin_mips_lower_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dd>Absolute comparison of two paired-single values (<code>cabs.</code><var>cond</var><code>.ps</code>, 109<code>bc1t</code>/<code>bc1f</code>). 110 111 <p>These functions compare <var>a</var> and <var>b</var> using <code>cabs.</code><var>cond</var><code>.ps</code> 112and return either the upper or lower half of the result. For example: 113 114 <pre class="smallexample"> v2sf a, b; 115 if (__builtin_mips_upper_cabs_eq_ps (a, b)) 116 upper_halves_are_equal (); 117 else 118 upper_halves_are_unequal (); 119 120 if (__builtin_mips_lower_cabs_eq_ps (a, b)) 121 lower_halves_are_equal (); 122 else 123 lower_halves_are_unequal (); 124</pre> 125 <br><dt><code>v2sf __builtin_mips_movt_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dt><code>v2sf __builtin_mips_movf_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dd>Conditional move based on absolute comparison (<code>cabs.</code><var>cond</var><code>.ps</code>, 126<code>movt.ps</code>/<code>movf.ps</code>). 127 128 <p>The <code>movt</code> functions return the value <var>x</var> computed by: 129 130 <pre class="smallexample"> cabs.<var>cond</var>.ps <var>cc</var>,<var>a</var>,<var>b</var> 131 mov.ps <var>x</var>,<var>c</var> 132 movt.ps <var>x</var>,<var>d</var>,<var>cc</var> 133</pre> 134 <p>The <code>movf</code> functions are similar but use <code>movf.ps</code> instead 135of <code>movt.ps</code>. 136 137 <br><dt><code>int __builtin_mips_any_c_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dt><code>int __builtin_mips_all_c_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dt><code>int __builtin_mips_any_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dt><code>int __builtin_mips_all_cabs_</code><var>cond</var><code>_ps (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>)</code><dd>Comparison of two paired-single values 138(<code>c.</code><var>cond</var><code>.ps</code>/<code>cabs.</code><var>cond</var><code>.ps</code>, 139<code>bc1any2t</code>/<code>bc1any2f</code>). 140 141 <p>These functions compare <var>a</var> and <var>b</var> using <code>c.</code><var>cond</var><code>.ps</code> 142or <code>cabs.</code><var>cond</var><code>.ps</code>. The <code>any</code> forms return true if either 143result is true and the <code>all</code> forms return true if both results are true. 144For example: 145 146 <pre class="smallexample"> v2sf a, b; 147 if (__builtin_mips_any_c_eq_ps (a, b)) 148 one_is_true (); 149 else 150 both_are_false (); 151 152 if (__builtin_mips_all_c_eq_ps (a, b)) 153 both_are_true (); 154 else 155 one_is_false (); 156</pre> 157 <br><dt><code>int __builtin_mips_any_c_</code><var>cond</var><code>_4s (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dt><code>int __builtin_mips_all_c_</code><var>cond</var><code>_4s (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dt><code>int __builtin_mips_any_cabs_</code><var>cond</var><code>_4s (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dt><code>int __builtin_mips_all_cabs_</code><var>cond</var><code>_4s (v2sf </code><var>a</var><code>, v2sf </code><var>b</var><code>, v2sf </code><var>c</var><code>, v2sf </code><var>d</var><code>)</code><dd>Comparison of four paired-single values 158(<code>c.</code><var>cond</var><code>.ps</code>/<code>cabs.</code><var>cond</var><code>.ps</code>, 159<code>bc1any4t</code>/<code>bc1any4f</code>). 160 161 <p>These functions use <code>c.</code><var>cond</var><code>.ps</code> or <code>cabs.</code><var>cond</var><code>.ps</code> 162to compare <var>a</var> with <var>b</var> and to compare <var>c</var> with <var>d</var>. 163The <code>any</code> forms return true if any of the four results are true 164and the <code>all</code> forms return true if all four results are true. 165For example: 166 167 <pre class="smallexample"> v2sf a, b, c, d; 168 if (__builtin_mips_any_c_eq_4s (a, b, c, d)) 169 some_are_true (); 170 else 171 all_are_false (); 172 173 if (__builtin_mips_all_c_eq_4s (a, b, c, d)) 174 all_are_true (); 175 else 176 some_are_false (); 177</pre> 178 </dl> 179 180 </body></html> 181 182