Next: , Previous: Paired-Single Arithmetic, Up: MIPS Loongson Built-in Functions


6.55.10.2 Paired-Single Built-in Functions

The following paired-single functions map directly to a particular MIPS instruction. Please refer to the architecture specification for details on what each instruction does.

v2sf __builtin_mips_pll_ps (v2sf, v2sf)
Pair lower lower (pll.ps).
v2sf __builtin_mips_pul_ps (v2sf, v2sf)
Pair upper lower (pul.ps).
v2sf __builtin_mips_plu_ps (v2sf, v2sf)
Pair lower upper (plu.ps).
v2sf __builtin_mips_puu_ps (v2sf, v2sf)
Pair upper upper (puu.ps).
v2sf __builtin_mips_cvt_ps_s (float, float)
Convert pair to paired single (cvt.ps.s).
float __builtin_mips_cvt_s_pl (v2sf)
Convert pair lower to single (cvt.s.pl).
float __builtin_mips_cvt_s_pu (v2sf)
Convert pair upper to single (cvt.s.pu).
v2sf __builtin_mips_abs_ps (v2sf)
Absolute value (abs.ps).
v2sf __builtin_mips_alnv_ps (v2sf, v2sf, int)
Align variable (alnv.ps).

Note: The value of the third parameter must be 0 or 4 modulo 8, otherwise the result will be unpredictable. Please read the instruction description for details.

The following multi-instruction functions are also available. In each case, cond can be any of the 16 floating-point conditions: f, un, eq, ueq, olt, ult, ole, ule, sf, ngle, seq, ngl, lt, nge, le or ngt.

v2sf __builtin_mips_movt_c_cond_ps (v2sf a, v2sf b, v2sf c, v2sf d)
v2sf __builtin_mips_movf_c_cond_ps (v2sf a, v2sf b, v2sf c, v2sf d)
Conditional move based on floating point comparison (c.cond.ps, movt.ps/movf.ps).

The movt functions return the value x computed by:

          c.cond.ps cc,a,b
          mov.ps x,c
          movt.ps x,d,cc
     

The movf functions are similar but use movf.ps instead of movt.ps.

int __builtin_mips_upper_c_cond_ps (v2sf a, v2sf b)
int __builtin_mips_lower_c_cond_ps (v2sf a, v2sf b)
Comparison of two paired-single values (c.cond.ps, bc1t/bc1f).

These functions compare a and b using c.cond.ps and return either the upper or lower half of the result. For example:

          v2sf a, b;
          if (__builtin_mips_upper_c_eq_ps (a, b))
            upper_halves_are_equal ();
          else
            upper_halves_are_unequal ();
          
          if (__builtin_mips_lower_c_eq_ps (a, b))
            lower_halves_are_equal ();
          else
            lower_halves_are_unequal ();