diff --git a/doc/tvm.tex b/doc/tvm.tex index 0fb71e93..1653aa8b 100644 --- a/doc/tvm.tex +++ b/doc/tvm.tex @@ -1584,10 +1584,12 @@ \section*{Introduction} \begin{itemize} \item {\tt B7xx} --- {\tt QUIET} prefix, transforming any arithmetic operation into its ``quiet'' variant, indicated by prefixing a {\tt Q} to its mnemonic. Such operations return {\tt NaN}s instead of throwing integer overflow exceptions if the results do not fit in {\it Integer\/}s, or if one of their arguments is a {\tt NaN}. Notice that this does not extend to shift amounts and other parameters that must be within a small range (e.g., 0--1023). Also notice that this does not disable type-checking exceptions if a value of a type other than {\it Integer\/} is supplied. \item {\tt B7A0} --- {\tt QADD} ($x$ $y$ -- $x+y$), always works if $x$ and $y$ are {\it Integer\/}s, but returns a {\tt NaN} if the addition cannot be performed. +\item {\tt B7A8} --- {\tt QMUL} ($x$ $y$ -- $xy$), returns the product of $x$ and $y$ if $-2^{256}\leq xy<2^{256}$. Otherwise returns a {\tt NaN}, even if $x=0$ and $y$ is a {\tt NaN}. \item {\tt B7A904} --- {\tt QDIV} ($x$ $y$ -- $\lfloor x/y\rfloor$), returns a {\tt NaN} if $y=0$, or if $y=-1$ and $x=-2^{256}$, or if either of $x$ or $y$ is a {\tt NaN}. +\item {\tt B7A98C} --- {\tt QMULDIVMOD} ($x$ $y$ $z$ -- $q$ $r$), where $q:=\lfloor x\cdot y/z\rfloor$, $r:=x\cdot y\bmod z$. If $z=0$, or if at least one of $x$, $y$, or $z$ is a {\tt NaN}, both $q$ and $r$ are set to {\tt NaN}. Otherwise the correct value of $r$ is always returned, but $q$ is replaced with {\tt NaN} if $q<-2^{256}$ or $q\geq2^{256}$. \item {\tt B7B0} --- {\tt QAND} ($x$ $y$ -- $x\&y$), bitwise ``and'' (similar to {\tt AND}), but returns a {\tt NaN} if either $x$ or $y$ is a {\tt NaN} instead of throwing an integer overflow exception. However, if one of the arguments is zero, and the other is a {\tt NaN}, the result is zero. \item {\tt B7B1} --- {\tt QOR} ($x$ $y$ -- $x\vee y$), bitwise ``or''. If $x=-1$ or $y=-1$, the result is always $-1$, even if the other argument is a {\tt NaN}. -\item {\tt B7B507} --- {\tt QUFITS 8} ($x$ -- $x'$), checks whether $x$ is an unsigned byte (i.e., whether $0\leq x<2^8$), and replaces $x$ with a {\tt NaN} if this is not the case; leaves $x$ intact otherwise (i.e., if $x$ is an unsigned byte). +\item {\tt B7B507} --- {\tt QUFITS 8} ($x$ -- $x'$), checks whether $x$ is an unsigned byte (i.e., whether $0\leq x<2^8$), and replaces $x$ with a {\tt NaN} if this is not the case; leaves $x$ intact otherwise (i.e., if $x$ is an unsigned byte or a {\tt NaN}). \end{itemize} \mysubsection{Comparison primitives} @@ -1991,7 +1993,6 @@ \section*{Introduction} \begin{itemize} \item {\tt F2FF} --- {\tt TRY} ($c$ $c'$ -- ), sets {\tt c2} to $c'$, first saving the old value of {\tt c2} both into the savelist of $c'$ and into the savelist of the current continuation, which is stored into $c.{\tt c0}$ and $c'.{\tt c0}$. Then runs $c$ similarly to {\tt EXECUTE}. If $c$ does not throw any exceptions, the original value of {\tt c2} is automatically restored on return from $c$. If an exception occurs, the execution is transferred to $c'$, but the original value of {\tt c2} is restored in the process, so that $c'$ can re-throw the exception by {\tt THROWANY} if it cannot handle it by itself. \item {\tt F3$pr$} --- {\tt TRYARGS $p$,$r$} ($c$ $c'$ -- ), similar to {\tt TRY}, but with {\tt CALLARGS $p$,$r$} internally used instead of {\tt EXECUTE}. In this way, all but the top $0\leq p\leq 15$ stack elements will be saved into current continuation's stack, and then restored upon return from either $c$ or $c'$, with the top $0\leq r\leq 15$ values of the resulting stack of $c$ or $c'$ copied as return values. -\item {\tt F2FE} --- {\tt TRYKEEP} ($c$ $c'$ -- ), similar to {\tt TRY}, but when an exception occurs, $c'$ receives all the stack slots populated upon entering $c$ with two exception arguments on top. All changes made by $c$ in those slots are kept and become visible to $c'$; all extra slots created by $c$ on top of the kept ones get discarded upon entering $c'$. \end{itemize} \mysubsection{Dictionary manipulation primitives}\label{p:prim.dict} @@ -2310,7 +2311,7 @@ \section*{Introduction} The message and address manipulation primitives listed below serialize and deserialize values according to the following TL-B scheme (cf.~\ptref{sp:tlb.brief}): \begin{verbatim} addr_none$00 = MsgAddressExt; -addr_extern$01 len:(## 8) external_address:(bits len) +addr_extern$01 len:(## 9) external_address:(bits len) = MsgAddressExt; anycast_info$_ depth:(#<= 30) { depth >= 1 } rewrite_pfx:(bits depth) = Anycast;