Hi, Based on LLVM lang spec (http://llvm.org/docs/LangRef.html#i_bitcast<http://www.google.com/url?sa=D&q=http://llvm.org/docs/LangRef.html%23i_bitcast&usg=AFQjCNFsBtV4Cr8zpL5UpgoIASRDFvcdSw>) notes I have understood ,that bitcast of vectors to vectors is OK,only if provided the vectors are of the same size.Is it possible to convert a vectors from different size? For example a vector of 3 elements Int16Ty type to vector having one element of 64 bit Int64Ty ? Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120504/557c89f1/attachment.html>
> Is it possible to convert a vectors from different size? For example > a vector of 3 elements Int16Ty type to vector having one element of > 64 bit Int64Ty ?Not with a bitcast. You'd probably use a shuffle followed by a bitcast for that: %temp = shufflevector <3 x i16> %incoming, <3 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 undef> %out = bitcast <4 x i16> %temp to i64 This creates a vector with its first elements the <3 x i16> and its last element undefined, which *can* be bitcast. Of course, the real question is why you want to do this: any solution is going to have nasty issues around: endianness, legal types, more stuff I haven't considered. Exactly how do you want the incoming <3 x i16> to contribute to the i64? A slightly eccentric answer to that question would make my code sequence horribly wrong. Tim.
> %temp = shufflevector <3 x i16> %incoming, <3 x i16> undef, <4 x i32> > <i32 0, i32 1, i32 2, i32 undef> > %out = bitcast <4 x i16> %temp to i64I seem to have misread the destination type, you'd obviously want "<1 x i64>" instead of "i64" in everything I've written. Tim.