Skip to content

Commit

Permalink
Revise Usual Arithmetic Conversions (#311)
Browse files Browse the repository at this point in the history
There are a few discrepancies between what I originally wrote here and
what DXC does. These changes adjust to the actual behavior and more
closely align with implicit conversion sequences.

Fixes #308
  • Loading branch information
llvm-beanz authored Sep 16, 2024
1 parent 3d83957 commit 8b2b3df
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions specs/language/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
\begin{itemize}
\item If either operand is of scoped enumeration type no conversion is
performed, and the expression is ill-formed if the types do not match.
\item If either operand is a \texttt{vector<T,X>}, vector extension is
performed with the following rules:
\item If either operand is a \texttt{vector<T,X>}, vector truncation or scalar
extension is performed with the following rules:
\begin{itemize}
\item If both vectors are of the same length, no extension is required.
\item If both vectors are of the same length, no dimension conversion is
required.
\item If one operand is a vector and the other operand is a scalar, the
scalar is extended to a vector via a Splat conversion (\ref{Conv.vsplat}).
scalar is extended to a vector via a Splat conversion (\ref{Conv.vsplat}) to
match the length of the vector.
\item Otherwise, if both operands are vectors of different lengths, the
expression is ill-formed.
vector of longer length is truncated to match the length of the shorter
vector (\ref{Conv.vtrunc}).
\end{itemize}
\item If either operand is of type \texttt{double} or \texttt{vector<double,
X>}, the other operator shall be converted to match.
Expand Down

0 comments on commit 8b2b3df

Please sign in to comment.