\subsection{\index{sort}sort}

SORT


\begin{tabular}{l}
  {\bf sort r3, r2, r1} \\
  {\bf ssort r3, r2, r1} \\
\end{tabular}

~~~~~~
Computes \{ r1 = r3 , r1\^1 = r2 \} if ( r2 {\htmlGt} r3 ) else \{ r1 = r2 ,
r1\^1 = r3 \}

~~~~~~
Compare the two source operands and writes the minimum of the two values to
the destination register and the maximum to destination register+1. The 
comparison is valid only for unsigned values (yet) so this instruction can't 
be used for IEEE floating point data. This instruction is of the {\bf 2r2w} 
form.

\begin{center}

\begin{tabular}{|l|l|l|l|l|l|}
 \hline
\multicolumn{1}{|r| }{size :
} & \multicolumn{1}{c| }{8
} & \multicolumn{1}{c| }{6
} & \multicolumn{1}{c| }{6
} & \multicolumn{1}{c| }{6
} & \multicolumn{1}{c| }{6
 } \\
 \hline
\multicolumn{1}{|r| }{bits :
} & {31 ~ ~ ~ ~ ~ ~ ~ ~ 24
} & {23 ~ ~ ~ ~ ~ ~ 18
} & {17 ~ ~ ~ ~ ~ ~ 12
} & {11 ~ ~ ~ ~ ~ ~ 6
} & {5 ~ ~ ~ ~ ~ ~ 0
 } \\
 \hline
\multicolumn{1}{|r| }{function :
} & \multicolumn{1}{c| }{OP\_SORT
} & \multicolumn{1}{c| }{Flags
} & \multicolumn{1}{c| }{Reg 3
} & \multicolumn{1}{c| }{Reg 2
} & \multicolumn{1}{c| }{Reg 1
}
\\ \hline

\end{tabular}



\begin{tabular}{|l|l|l|l|}
 \hline
\multicolumn{1}{|c| }{~ ~ Flags ~ ~
} & \multicolumn{1}{c| }{Syntax
} & {Values
} & {Function
 } \\
 \hline
\multicolumn{1}{|c| }{23-22
} & {.q, .d or .b postfix
} & {*
} & {Defines the size parameter
 } \\
 \hline
\multicolumn{1}{|c| }{21
} & {s- prefix
} & {1 if set
} & {Defines if the operation is SIMD
 } \\
 \hline
\multicolumn{1}{|c| }{20-18
} & {(none yet)
} & {0
} & {Reserved
}
\\ \hline

\end{tabular}


~

{\bf Examples : }
\end{center}


R1 contains 0x0000000500000003 (in a 64-bit system)\\
R2 contains 0x0000000700000001

{\tt
{\bf ssort.b r1,r2,r3 }: r3 = 0x0000000500000001 , r4 = 0x0000000700000003\\
{\bf sort r1,r2,r3 }: r3 = 0x0000000500000003 , r4 = 0x0000000700000001
}

{\bf Performance (FC0 only) :}


{\em Execution Unit :} Increment Unit\\
{\em Latency :} 1 cycle\\
{\em Throughput :} 1 per cycle per IU.\\

~

\pagebreak

