[PATCH] Allow casts of mixed-size same-arity vectors
Hal Finkel
hfinkel at anl.gov
Wed Sep 11 12:04:19 PDT 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mixed-size-vec-casts.patch
Type: text/x-patch
Size: 8211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130911/c2f29dcf/attachment.bin>
More information about the cfe-commits
mailing list