mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 17:00:05 +01:00
[SPCA] Add more notes on conditional moves and jumps
This commit is contained in:
@@ -20,6 +20,9 @@ and \texttt{OF} is set as above, where \texttt{t = a - b}.
|
||||
Another instruction that is used is \texttt{testX src2, src1} (X again a size postfix, easier: \texttt{testX b, a}), and acts like computing \texttt{a \& b} and where \texttt{ZF} is set if \texttt{a \& b == 0}
|
||||
and \texttt{SF} is set if \texttt{a \& b < 0}.
|
||||
|
||||
\inlineex Assume \texttt{x = src1}, \texttt{y = src2} in \texttt{cmpl y, x}. Then, when you use the condition codes with \texttt{cmovle},
|
||||
the instruction is executed only if $x \leq y$ (i.e. the operands of the compare instructions in the AT\&T syntax are flipped)
|
||||
|
||||
\content{Zeroing register} We can use a move instruction, but that is less efficient than using \texttt{xorl reg, reg},
|
||||
where \texttt{reg} is the 32-bit version of the reg we want to zero. This works because on 32-bit operations,
|
||||
the upper 32 bit of the 64 bit register will be zeroed.
|
||||
|
||||
Reference in New Issue
Block a user