Vector Select Examples - Nintendo Ultra64 Programmer's Manual

Rsp
Table of Contents

Advertisement

Revision 1.0
For single precision vch not followed by a vcl, VCO must be set
Note:
before another compare (by a move, add, or compare whose results are
not meaningful).
The vcr instruction is similar to vcl, except that
instead of 2's complement number, such as for clamping to a power of 2. vcr
is only single precision and ignores the contents of VCO for input.

Vector Select Examples

The following code fragments illustrate various vector selects.
This code demonstrates a sort of the parallel elements within three vectors
(finding the min, mid, and max of 8 triples). After executing this code, min
will contain the smallest elements, max will contain the largest, and mid will
contain the intermediate elements:
vge
tmp1, min, mid
vlt
min, min, mid
vge
tmp2, min, max
vlt
min, min, max
vge
max, tmp1, tmp2
vlt
mid, tmp1, tmp2
This code demonstrates the generation of 3D clip codes for trivial rejection,
testing each x,y,z component against w. It also uses vector halves,
clip-testing two vertices at the same time (the first vertex is in elements 0-3,
the second in elements 4-7):
vch
vtmp, vout_int, vout_int[3h] # compare with w
vcl
vtmp, vout_frac, vout_frac[3h]
cfc2
$1, $vcc
Other combinations are left as an exercise to the reader.
VU Select Instructions
vt
is a 1's complement
# get clip codes
73

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents