<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 28, 2012, at 6:58 PM, Andrew Trick <<a href="mailto:atrick@apple.com">atrick@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Author: atrick<br>Date: Tue Aug 28 20:58:55 2012<br>New Revision: 162821<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=162821&view=rev">http://llvm.org/viewvc/llvm-project?rev=162821&view=rev</a><br>Log:<br>Fix ARM vector copies of overlapping register tuples.<br></blockquote><div><br></div><div>Nice!</div><br><blockquote type="cite">I have tested the fix, but have not been successfull in generating<br>a robust unit test. This can only be exposed through particular<br>register assignments.<br></blockquote><div><br></div><div>You may be able to build a register labyrinth out of two inline asms, similar to test/CodeGen/ARM/subreg-remat.ll</div><div><br></div><div>  %v = vld3</div><div>  inline asm, clobbers d8-d31</div><div><div>  inline asm, clobbers d0-d1, d10-d31</div><div>  vst3 %v</div><div><br></div><div>If you're lucky, RA will split the %v live range between the two inline asms to avoid a spill.</div></div><div><br></div><div><blockquote type="cite"><span style="font-family: monospace; ">+  if (!Opc)</span><br style="font-family: monospace; "><span style="font-family: monospace; ">+    llvm_unreachable("Impossible reg-to-reg copy");</span><br style="font-family: monospace; "></blockquote></div><div><br></div><div>Assert? (llvm_unreachable compiles away in -Asserts builds).</div><div><br></div><blockquote type="cite">+  // Copy register tuples backward when the first Dest reg overlaps with SrcReg.<br>+  if (TRI->regsOverlap(SrcReg, TRI->getSubReg(DestReg, BeginIdx))) {<br>+    BeginIdx = BeginIdx + ((SubRegs-1)*Spacing);<br>+    Spacing = -Spacing;<br>+  }<br></blockquote><div><br></div><div>Should Spacing be signed? Or should there be a comment that modulo arithmetic works?</div><div><br></div><blockquote type="cite">+#ifndef NDEBUG<br>+  SmallSet<unsigned, 4> DstRegs;<br>+#endif<br>   for (unsigned i = 0; i != SubRegs; ++i) {<br>     unsigned Dst = TRI->getSubReg(DestReg, BeginIdx + i*Spacing);<br>     unsigned Src = TRI->getSubReg(SrcReg,  BeginIdx + i*Spacing);<br>     assert(Dst && Src && "Bad sub-register");<br>+#ifndef NDEBUG<br>+    DstRegs.insert(Dst);<br>+    assert(!DstRegs.count(Src) && "destructive vector copy");<br></blockquote><br></div><div>Maybe swap these two? We do filter identity copies, but it's not an error to ask for one.</div><br><div>/jakob</div><div><br></div></body></html>