|
@@ -7465,7 +7465,7 @@ $0011$ and $0101$ yields $0110$. Notice that in the row of the table
|
|
|
for the bit $1$, the result is the opposite of the second bit. Thus,
|
|
|
the \code{not} operation can be implemented by \code{xorq} with $1$ as
|
|
|
the first argument as follows, where $\Arg$ is the translation of
|
|
|
-$\Atm$.
|
|
|
+$\Atm$ to x86.
|
|
|
\[
|
|
|
\CASSIGN{\Var}{\CUNIOP{\key{not}}{\Atm}}
|
|
|
\qquad\Rightarrow\qquad
|
|
@@ -7482,10 +7482,10 @@ $\Atm$.
|
|
|
\Arg &::=& \key{\%}\itm{bytereg}\\
|
|
|
\itm{cc} & ::= & \key{e} \MID \key{ne} \MID \key{l} \MID \key{le} \MID \key{g} \MID \key{ge} \\
|
|
|
\Instr &::=& \key{xorq}~\Arg\key{,}~\Arg
|
|
|
- \MID \key{cmpq}~\Arg\key{,}~\Arg \MID \\
|
|
|
- && \key{set}cc~\Arg
|
|
|
- \MID \key{movzbq}~\Arg\key{,}~\Arg
|
|
|
- \MID \key{j}cc~\itm{label}
|
|
|
+ \MID \key{cmpq}~\Arg\key{,}~\Arg
|
|
|
+ \MID \key{set}cc~\Arg
|
|
|
+ \MID \key{movzbq}~\Arg\key{,}~\Arg \\
|
|
|
+ &\MID& \key{j}cc~\itm{label}
|
|
|
\end{array}
|
|
|
}
|
|
|
|
|
@@ -7580,17 +7580,17 @@ $x < y$, then write \code{cmpq} $y$\code{,} $x$. The result of
|
|
|
cannot be accessed directly but it can be queried by a number of
|
|
|
instructions, including the \key{set} instruction. The instruction
|
|
|
$\key{set}cc~d$ puts a \key{1} or \key{0} into the destination $d$
|
|
|
-depending on whether the comparison comes out according to the
|
|
|
-condition code \itm{cc} (\key{e} for equal, \key{l} for less, \key{le}
|
|
|
-for less-or-equal, \key{g} for greater, \key{ge} for
|
|
|
-greater-or-equal). The \key{set} instruction has a quirk in
|
|
|
-that its destination argument must be single byte register, such as
|
|
|
-\code{al} (L for lower bits) or \code{ah} (H for higher bits), which
|
|
|
-are part of the \code{rax} register. Thankfully, the \key{movzbq}
|
|
|
-instruction can be used to move from a single byte register to a
|
|
|
-normal 64-bit register. The abstract syntax for the \code{set}
|
|
|
-instruction differs from the concrete syntax in that it separates the
|
|
|
-instruction name from the condition code.
|
|
|
+depending on whether the contents of the EFLAGS register matches the
|
|
|
+condition code \itm{cc}: \key{e} for equal, \key{l} for less, \key{le}
|
|
|
+for less-or-equal, \key{g} for greater, \key{ge} for greater-or-equal.
|
|
|
+The \key{set} instruction has a quirk in that its destination argument
|
|
|
+must be single byte register, such as \code{al} (L for lower bits) or
|
|
|
+\code{ah} (H for higher bits), which are part of the \code{rax}
|
|
|
+register. Thankfully, the \key{movzbq} instruction can be used to
|
|
|
+move from a single byte register to a normal 64-bit register. The
|
|
|
+abstract syntax for the \code{set} instruction differs from the
|
|
|
+concrete syntax in that it separates the instruction name from the
|
|
|
+condition code.
|
|
|
|
|
|
\python{The x86 instructions for jumping are relevant to the
|
|
|
compilation of \key{if} expressions.}
|
|
@@ -7608,9 +7608,9 @@ whether the result in the EFLAGS register matches the condition code
|
|
|
\itm{cc}, otherwise the jump instruction falls through to the next
|
|
|
instruction. Like the abstract syntax for \code{set}, the abstract
|
|
|
syntax for conditional jump separates the instruction name from the
|
|
|
-condition code. For example, \JMPIF{\key{'le'}}{\key{foo}} corresponds
|
|
|
-to \code{jle foo}. Because the conditional jump instruction relies on
|
|
|
-the EFLAGS register, it is common for it to be immediately preceded by
|
|
|
+condition code. For example, \JMPIF{\QUOTE{\code{le}}}{\QUOTE{\code{foo}}}
|
|
|
+corresponds to \code{jle foo}. Because the conditional jump instruction
|
|
|
+relies on the EFLAGS register, it is common for it to be immediately preceded by
|
|
|
a \key{cmpq} instruction to set the EFLAGS register.
|
|
|
|
|
|
|