<div dir="ltr">On Tue, Sep 17, 2013 at 2:02 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">----- Original Message -----<br>
><br>
> On Mon, Sep 16, 2013 at 8:41 PM, <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> < <a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a> ><br>
> wrote:<br>
><br>
> ================<br>
> Comment at: include/clang/AST/Expr.h:3474<br>
> @@ +3473,3 @@<br>
> +/// vector type of the same arity.<br>
> +class ConvertVectorExpr : public Expr { // Should this be an<br>
> ExplicitCastExpr?<br>
> +private:<br>
> ----------------<br>
><br>
> Eli Friedman wrote:<br>
> > No, this should not be a CastExpr.<br>
> Okay; I copied this comment from the AsTypeExpr node, so we should<br>
> probably remove it from there too.<br>
><br>
><br>
><br>
> Okay.<br>
><br>
><br>
><br>
><br>
> ================<br>
> Comment at: lib/CodeGen/CGExprScalar.cpp:1011<br>
> @@ +1010,3 @@<br>
> + Res = Builder.CreateIntCast(Src, DstTy, InputSigned, "conv");<br>
> + else if (InputSigned)<br>
> + Res = Builder.CreateSIToFP(Src, DstTy, "conv");<br>
> ----------------<br>
><br>
> Eli Friedman wrote:<br>
> > What if the destination type is a bool vector?<br>
> I think bool vectors are explicitly forbidden (in r190721).<br>
><br>
><br>
><br>
> You can still use the ext_vector_type attribute to get one.<br>
<br>
</div></div>Ah, thanks! The code generator seems to quite happily produce (and the IR validator accepts):<br>
<br>
%conv = fptoui <8 x float> %0 to <8 x i1><br>
<br>
and:<br>
<br>
%conv = trunc <8 x i16> %0 to <8 x i1><br>
<br>
will that be sufficient, do we need to do something special? Would it be better to explicitly compare against zero?<br>
<div><div class="h5"><br><br></div></div></blockquote><div>Your documentation says it will do what a C cast would do (which is compare against zero, not truncate).<br><br></div><div>-Eli <br></div></div></div></div>