Ping?<br><br>Any comments or suggestions?<br><br><div class="gmail_quote">On Mon, Jul 16, 2012 at 4:52 PM, Akira Hatanaka <span dir="ltr"><<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Duncan and llvm developers,<br><br>The attached patch makes the function return true if the conversion is between a vector and an integer of the same size.<br>
<br>Please review when you have time.<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">
On Tue, Jul 10, 2012 at 12:21 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hi Akira,<br>
<div><br>
> This is the definition of BITCAST in include/llvm/CodeGen/ISDOpcodes.h:<br>
><br>
> // BITCAST - This operator converts between integer, vector and FP<br>
> // values, as if the value was stored to memory with one type and loaded<br>
> // from the same address with the other type (or equivalently for vector<br>
> // format conversions, etc). The source and result are required to have<br>
> // the same bit size (e.g. f32 <-> i32). This can also be used for<br>
> // int-to-int or fp-to-fp conversions, but that is a noop, deleted by<br>
> // getNode().<br>
><br>
> If I can assume the bitcast instruction in LLVM IR has the same definition, does<br>
> this mean that the following instruction<br>
><br>
> %dst = bitcast i32 %src to v2i16<br>
><br>
> is equivalent to the following sequence of instructions (which I think is lossless)?<br>
><br>
> store i32 %src, i32* %ptr<br>
> %ptr2 = bitcast i32* %ptr to v2i16*<br>
> %dst = load v2i16* %ptr2<br>
<br>
</div>while there has been some discussion about changing the definition of bitcast,<br>
yes, this is currently the definition. That canLoslesslyBitCastTo returns<br>
false for bitcast of i32 to <2 x i16> is probably just an oversight. Please<br>
feel free to send in a patch fixing it.<br>
<br>
Ciao, Duncan.<br>
<div><br>
><br>
><br>
> I am trying to change all vector types (v2i16 and v4i8) in<br>
> include/llvm/IntrinsicsMips.td to i32, but I can't do that because the code in<br>
> CodeGenFunction::EmitBuiltinExpr (in clang/CGBuiltin.cpp) raises an assertion<br>
> when it calls Type::canLoslesslyBitCastTo to check whether conversion between<br>
> v2i16 (or v4i8) and i32 is legal.<br>
><br>
> To work around this problem, I can put back CodeGenFunction::EmitMipsBuiltinExpr<br>
> which was removed in r159368 and add code to do type conversions, but I prefer<br>
> not to do this.<br>
><br>
><br>
> On Mon, Jul 2, 2012 at 5:40 PM, Akira Hatanaka <<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a><br>
</div><div>> <mailto:<a href="mailto:ahatanak@gmail.com" target="_blank">ahatanak@gmail.com</a>>> wrote:<br>
><br>
> Type::canLoslesslyBitCastTo(Type *Ty) in lib/VMCore/Type.cpp always returns<br>
> false when it checks whether an integer can be bitcast to a vector or vice<br>
> versa.<br>
><br>
> For example, (i32 => v2i16) or (v2i16 => i32) is false.<br>
><br>
> But it seems that it returns true if it is checking conversion between two<br>
> vector types which have the same size.<br>
><br>
> For example, (v4i8 => v2i16) would return true.<br>
><br>
> What is the rationale behind this?<br>
><br>
><br>
><br>
><br>
</div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>