<div dir="ltr"><div><div>It seems to me that you'd actually want to keep the BITCAST's legal and implement a pattern in the .td files for doing them.<br></div>For example, on PPC our vector bitcasts are no-ops (except that we prefer to keep some types of vectors in some of the register classes). You can see all the bitconvert patterns in lib/Target/PowerPC/PPCInstrVSX.td.<br><br></div>That will allow the instruction selector to select the bitcasts and won't change things like the load you included in your message.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 25, 2017 at 10:26 PM, Alex Susu via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Hello.<br>
    I am trying to emulate in software in my SIMD processor back end vector types with elements i32 using the native vector types with i16 (for example: v64i32 with v128i16).<br>
    For example, when I want to add 2 v64i32 I use first a getNode(ISD::BITCAST, ...) to typecast the operands of add. But this does not seem to work - I tried to get inspired from <a href="http://llvm.org/docs/doxygen/html/X86ISelLowering_8cpp_source.html" rel="noreferrer" target="_blank">http://llvm.org/docs/doxygen/h<wbr>tml/X86ISelLowering_8cpp_sourc<wbr>e.html</a>. When I use that instruction I get an error saying "Cannot select [...] v128i16 = bitcast txy", where txy is of type t64i32.<br>
  So I tried to declare at the beginning of the ISelLowering class:<br>
    setOperationAction(ISD::BITCAS<wbr>T, MVT::v64i32, Expand /* or Promote */);<br>
    AddPromotedToType (ISD::BITCAST, MVT::v64i32, MVT::v128i16); // and also MVT::v128i16, MVT::v64i32<br>
  This eventually led to replacing during Instruction selection the<br>
       v128i16 = bitcast t52<br>
     with<br>
       v128i16,ch = load<LD256[FixedStack3]> t110, FrameIndex:i64<3>, undef:i64<br>
     but the load<LD256[FixedStack3]> operation is not really good for me.<br>
<br>
    Can somebody help me? I need a simple bitcast operation that just changes the type of the vector SDNode without any further complication, if possible.<br>
<br>
  Thank you,<br>
    Alex<br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>