[llvm-commits] A patch to add vector-zext support to LLVM

Frits van Bommel fvbommel at gmail.com
Sun Feb 20 02:40:07 PST 2011


On Sun, Feb 20, 2011 at 10:53 AM, Rotem, Nadav <nadav.rotem at intel.com> wrote:
> Currently (according to LangRef) LLVM does not support code generation of
> vector zext (PR 9267). It looks like the problem is in the DAGCombiner which
> folds the zext into complex load instructions. The attached patch prevents
> this optimization on vectors since AFAIK none of the supported targets knows
> how to perform load+vector_zext in one instruction.
>
> This patch enables code generation of vector zexts, which are expanded
> properly.
>
> Added tests and changed LangRef.

I can't comment on the correctness of the code, but:

 <h5>Arguments:</h5>
 <p>The '<tt>zext</tt>' instruction takes a value to cast, which must be of
-   <a href="#t_integer">integer</a> type, and a type to cast it to, which must
-   also be of <a href="#t_integer">integer</a> type. The bit size of the
-   <tt>value</tt> must be smaller than the bit size of the destination type,
+   <a href="#t_integer">integer</a> type, or a vector of integers, and a type
+   to cast it to, which must also be of <a
href="#t_integer">integer</a> type or
+   a vector of integers. The bit size of the <tt>value</tt> must be
smaller than
+   the bit size of the destination type,
    <tt>ty2</tt>.</p>

This look insufficiently precise. IMHO it should require that either
both source and destination are integers, or they are both vectors of
the same number of integers.

Currently, the text implies one can zext e.g. i32 to <2 x i32>, <2 x
i16> to i64, and <2 x i32> to <4 x i32>.
Though looking at the code, CastInst::castIsValid() seems to accept
some of these too... :(



More information about the llvm-commits mailing list