<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><span class="gmail-"><blockquote type="cite"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">Our target
          doesn't support load i64, so we have following code
          in XXXISelLowering.cpp</div>
        <div style="font-family:arial,helvetica,sans-serif"><br>
        </div>
        <div style="font-family:arial,helvetica,sans-serif"> 
            setOperationAction(ISD::<wbr>LOAD, MVT::i64, Custom);</div>
        <div style="font-family:arial,helvetica,sans-serif">  </div>
        <div style="font-family:arial,helvetica,sans-serif">Transform load
          i64 to load v2i32 during type legalization.</div>
      </div>
    </blockquote>
    <br></span>
    If misaligned load v2i32 isn't legal, don't generate it.  If it is
    legal, you might need to mess with your implementation of
    allowsMisalignedMemoryAccesses<wbr>.<span class="gmail-"><br>
    <br></span></div></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​Will check that. ​Just a little more explanation about the misaligned part. We declare i64 is 8 align in the DataLayout, and in "%0 = load i64, *i64 ptr, align 4" the alignment is 4. In the op legalization stage, it will go through</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">    SelectionDAGLegalize::LegalizeLoadOps -> </font><span style="font-family:arial,helvetica,sans-serif">TargetLowering::expandUnalignedLoad</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div class="gmail_default">We don't expect load i64 would be 4 align, so how do I know I will generate misaligned load v2i32 beforehand? Another question is usually what we do to handle load i64 if that is not natively supported? Is it correct transforming load i64 to load v2i32? An existing backend example would be great.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><span class="gmail-">
    <blockquote type="cite">
      <div dir="ltr">
        <div style="font-family:arial,helvetica,sans-serif">Besides of
          that, our target has bitset/bitextract instructions, we want
          to use them on bitfield</div>
        <div style="font-family:arial,helvetica,sans-serif">access, too.
          But don't know how to do that.</div>
      </div>
    </blockquote>
    <br></span>
    This is generally implemented by pattern-matching the shift and mask
    operations.  ARM has instructions like this if you're looking for
    inspiration; look for UBFX, SBFX and BFI.</div></blockquote><div><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">​Thanks. Having example​ is good. :-)</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Regards,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div></div>