version 2009-08-08

SMAX : Signed MAXimum

The signed value of the source register (snd) is compared with the signed value of the other operand (si4, Imm4 or Imm16). If si4>snd, then si4 is written to

Note : the early implementation works by comparing the values (with a substraction) then conditionally aborting the write of si4, so long forms and extended forms may not work as expected in the first versions.

The Signed MINimum instruction is identical but with a reversed condition.

The Unsigned MAXimum instruction is identical but with an unsigned comparison.

The SMAX, SMIN, UMAX and UMIN instructions are useful when clipping coordinates or samples.

; Signed version :
 SMAX R1 R2       ; If R1>R2    then R1->R2
 SMAX 1234h R1 R2 ; If R1>1234h then R1->R2 else 1234h->R2
 SMIN R1 R2       ; If R1<R2    then R1->R2
 SMIN 1234h R1 R2 ; If R1<1234h then R1->R2 else 1234h->R2
; Unsigned version :
 UMAX R1 R2       ; If R1>R2    then R1->R2
 UMAX 1234h R1 R2 ; If R1>1234h then R1->R2 else 1234h->R2
 UMIN R1 R2       ; If R1<R2    then R1->R2
 UMIN 1234h R1 R2 ; If R1<1234h then R1->R2 else 1234h->R2