<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi Peter,</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">  For i64, our custom backend only support load/store instruction. We refer to Sparc,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">making load i64 as load v2i32 rather then two load i32 (LLVM default Expand). I would</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">be happy to hear other's experience on this, too.</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">HTH,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">chenwj</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-13 23:44 GMT+08:00 Peter Bel via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I'm trying to write an LLVM backend for Epiphany arch, and I wonder if someone can give me some advice on how to implement load/store optimization. The CPU itself is 32-bit, but it supports wider 64-bit loads and store. So the basic idea is to make use of those by combining narrow ones.<br><br></div><div>I've checked how it is done in AArch64 and Hexagon, and my current code is very close to the AArch64 one (used it as a kick-off). The problem lies in constraints imposed by the platform.<br><br></div><div>The main constraint is that regs used should be sequential, lower reg should be even/zero. And obviously frame offsets should be sequential to be merged, dword-aligned for the lower reg offset.<br><br></div><div>Because of those constraints I'm currently running this pass on pre-emit, after RA and frame finalization. But at that point most of the choices made (RA, frame offsets), and those are obviously suboptimal. The most common issue can look somehow like this:<br></div><div>    str r1, [fp, -4]<br></div><div>    str r2, [fp, -8]<br></div><div>Those two stores can't be merged because the lower reg (r1) is not even. To merge them, r1 should be changed to r0, and r2 to r1. Sometimes the same problem happens when the frame offset is misaligned, e.g. r0 will have offset aligned to word, not dword.<br><br></div><div>Can someone please point me out in which direction should I move? And also - at which step should I apply such pass? If on PreRA - how to set reg constraints such as regsequence, as well as frame constraints? If before frame finalization - how to  set frame constraints? If on pre-emit like i'm doing now - how to optimize and rewrite frame offsets and regs?<br><br></div><div>Thanks,<br></div><div>Petr<br></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>