<div dir="ltr"><div>Hi Quentin,</div><div><br></div><div>Thanks! I was worried I might be missing something very obvious. I'll look into your suggestions.</div><div><br></div><div>Kind regards,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Missatge de Quentin Colombet <<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>> del dia dt., 5 de maig 2020 a les 19:59:<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 style="overflow-wrap: break-word;">Hi Roger,<br><div><br><blockquote type="cite"><div>On May 4, 2020, at 11:37 PM, Roger Ferrer Ibáñez <<a href="mailto:rofirrim@gmail.com" target="_blank">rofirrim@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div>Hi Quentin,<br></div><br><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">
<br>
It sounds like you only need the earlyclobber description for the N, N variant.<br>
In other words, as long as you use different opcodes for widen-op NN and widen-op WN, you model exactly what you want.<br>
<br>
What am I missing?<br></blockquote><div><br></div><div>we are using different opcodes for widen-op NN and widen-op WN.</div><div><br></div><div>My understanding is that not setting earlyclobber to the W, N variant would allow the RegAlloc to do an allocation like this</div><div><br></div><div style="margin-left:40px">W1 = widen-op W2, N3</div></div></div></div></blockquote><div><br></div><div>Sorry I mixed up earlyclobber and tie-operand. For some reason I thought earlyclobber could be set individually on the src operands to say that they interfere with the definition...</div><div>That’s obviously wrong.</div><div><br></div><div>So yeah there isn’t anything in LLVM right now that conveys the semantic you want.</div><div><br></div><div>If you’re really concerned that you would use too many registers, you can either:</div><div>1. Add this concept to llvm </div><div>2. Repair after regalloc</div><div><br></div><div>For #2, basically you don’t set any constraints in regalloc then after regalloc (i.e., expand pseudo), you check if there are some overlapping and if so, you change the allocation locally.</div><div>E.g.,</div><div>W1 = W2, N3</div><div>=></div><div>N4 = copy N3</div><div>W1 = copy W2, N4</div><div>or</div><div><div>W3 = copy W2, N3</div><div><div>W1 = copy W3</div></div><div><br></div><div>Depending on what is the cheapest with respect to what registers are available (you may have to spill).</div><div><br></div><div>Cheers,</div><div>-Quentin</div></div><div><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div><br></div><div>but this is not correct in that target because W1 and N3 are of different kind and W1 (being the group of registers N2, N3) overlaps N3.</div><div><br></div><div>If I understand earlyclobber semantics correctly, earlyclobber would allocate the destination to something that doesn't overlap W2 and also doesn't overlap N3. For instance<br></div><div><br></div><div style="margin-left:40px">W3 = widen-op W2, N3<br></div><div><br></div><div>But because the dest is a W register the target's constraint only applies to N3, not to W2, so the following should be OK (however RegAlloc would never make such an assignment under earlyclobber)<br></div><div><br></div><div style="margin-left:40px">W2 = widen-op W2, N3</div><div><br></div><div>In principle earlyclobber is always going to do allocations that are correct for the target but there are a valid ones that will be missed.<br></div><div><br></div><div>Kind regards,<br></div></div><br>-- <br><div dir="ltr">Roger Ferrer Ibáñez<br></div></div>
</div></blockquote></div><br></div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Roger Ferrer Ibáñez<br></div>