Hal —

Am I understanding this correctly:

        vector4float x;
        vector4int16 y = (vector4int16)x; // this is a conversion
        vector4int32 z = (vector4int32)x; // this is a bitcast

This seems confusing in the extreme.

Thanks,
– Steve

On Sep 11, 2013, at 12:04 PM, Hal Finkel <[email protected]> wrote:

> Hello,
> 
> Please review the attached patch which adds support for casting between 
> vector types with different sizes (but the same number of vector elements). 
> LLVM supports these conversions for the underlying LLVM vector types (just as 
> for the scalar types), and this adds support in Clang, requiring minor 
> modifications in Sema and CodeGen.
> 
> For example, this patch allows the following to work:
> 
> typedef double vector4double __attribute__((__vector_size__(32)));
> typedef float  vector4float  __attribute__((__vector_size__(16)));
> 
> vector4float flt_trunc(vector4double x) {
>  return (vector4float) x;
> }
> 
> On some targets the code generation for these conversions has been optimized 
> (autovectorization can produce these conversions), and accessing these 
> capabilities from Clang is important, for example, when writing intrinsics 
> headers (which, when possible, we prefer to implement in terms of generic IR).
> 
> Thanks in advance,
> Hal
> 
> -- 
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> <mixed-size-vec-casts.patch>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to