\subsection{\index{abs}abs}

\index{absolute value}
ABSolute value


\begin{tabular}{l}
 {\bf abs r2, r1} \\
 {\bf sabs r2, r1}
\end{tabular}

~~~~~~
Computes r1 = (not(r2) + 1) if MSB(r2) == 1

~~~~~~
This instruction negates the source operand in a special unit that
is designed for low latency when large data are processed. If the sign bit
(MSB)
of the source is set (the number is negative) then the value is written back
to
the register set, or else (it is already positive) the result is cancelled
(that's how it works in scalar mode, not in SIMD mode...).

~~~~~~
This instruction is designed to work in the 2s-complement number sytem
(signed integer numbers) and is not subject to saturation/overflow problems.
Notice though that negating -128'' (if bytes are treated) will nicely
fail to give you +128, without trapping. You've been warned.

\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\_ABS
} & \multicolumn{1}{c| }{Flags
} & \multicolumn{1}{c| }{0
} & \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 Example : }
\end{center}


R1 contains 0xFF05891213450100 (in a 64-bit system)

{\tt
{\bf sabs.b r1,r2 }: r2 = 0x0105771213450100 \\
}

\begin{center}
{\bf Performance (FC0 only) :}
\end{center}


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

~

\pagebreak

