<div dir="ltr">Should 32-bit X86_INTR also save the whole YMM and ZMM register when AVX or AVX512 is enabled? Currently it only saves the XMM portions.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 11:11 AM, Juergen Ributzka via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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"><div style="word-wrap:break-word"><div>Hi Quentin,</div><div><br></div><div>I also had to do some git archeology first :)</div><div><br></div><div>CSR_64_AllRegs/CSR_64_AllRegs_AVX were originally introduced for the AnyReg calling convention, which could only be used by the stackmap and patchpoint intrinsics. Functions cannot uses this calling convention and therefore there shouldn’t be any spill code generated. Looks like CSR_64_AllRegs/CSR_64_AllRegs_AVX are now also used by the X86_INTR calling convention.</div><div><br></div><div>Anyways, getCalleeSaved registers is already checking the current configuration and returns the appropriate callee save register list. The CSR_64_AllRegs_AVX was broken and we should return a separate one for AVX512. Craig already added CSR_64_AllRegs_AVX512 for the X86_INTR calling convention in r269018. We can use the same CSR for the AnyReg calling convention.</div><div><br></div><br><div><span class=""><blockquote type="cite"><div>On May 9, 2016, at 4:36 PM, Quentin Colombet <<a href="mailto:qcolombet@apple.com" target="_blank">qcolombet@apple.com</a>> wrote:</div><br><div><div style="word-wrap:break-word">Hi Juergen (you were in the blame list for the calling convention stuff :)),<div><br></div><div>I was doing a bit of archeology with the calling convention stuff on X86, because I found some bugs with the machine verifier and I wanted to double check the other calling convention to make sure they are correct and I need your help to figure out what was the intent for each of those classes.</div><div><br></div><div>Basically, the problem is that we have a bunch of callee saved registers that we saved that may not actually be supported by the current configuration.</div><div><br></div><div>For instance, the bug that this specific commit was fixing was that we pushed AVX512 registers even when AVX512 was not used.</div></div></div></blockquote><blockquote type="cite"><div><div style="word-wrap:break-word"><div><br></div><div>First, regarding the design, were the returned CSRs supposed to be directly usable or do users of the getCalleeSaved need to intersect with what the current configuration has?</div><div>I found the latter annoying to use, but I could see it is also annoying to write a different CSR list for each configuration.</div></div></div></blockquote><div><br></div></span><div>We usually create a separate CSR for each configuration.</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><br></div><div>Second, what is the default for AllRegs/MostRegs supposed to be?</div><div>Right now, it seems to assume we have AVX512 and such, thus it is pretty easy to end up with an assembly file having encoding problems like this:</div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><b>old.s:38:2: </b></span><span style="color:#c33720"><b>error: </b></span><span><b>instruction requires: AVX-512 ISA AVX-512 VL ISA</b></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> vmovups %ymm31, 1008(%rsp) ## 32-byte Spill</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(52,189,38)"><span><b> ^</b></span></div></div><div><span><b><br></b></span></div></div></div></blockquote><div><br></div></span><div>MostRegs was defined for the cold calling convention. AllRegs is supposed to be all registers and was originally defined for the AnyReg calling convention.</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div>From what I saw, it seems to me that the sets of CSRs were supposed to be directly usable, but allregs, mostregs, and maybe others, do not follow that direction.</div></div></div></blockquote><div><br></div></span><div>What is wrong with the MostRegs list?</div><span class=""><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><br></div><div><div>How would you recommend we fix this?</div></div></div></div></blockquote><div><br></div></span><div>Use a separate CSR for AVX512 (as Craig did).</div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><br></div><div>Thanks,</div><div>-Quentin</div></div></div></blockquote><div><br></div><div>Cheers,</div><div>Juergen</div><div><div class="h5"><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div>On May 9, 2016, at 3:37 PM, Quentin Colombet via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:</div><br><div><div>Author: qcolombet<br>Date: Mon May  9 17:37:05 2016<br>New Revision: 268983<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268983&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=268983&view=rev</a><br>Log:<br>[X86] Fix the AllRegs AVX calling convention.<br><br>We used to list registers that were not in the AVX space. In other<br>words, we were pushing registers that the ISA cannot encode<br>(YMM16-YMM31).<br><br>This is part of <a href="http://llvm.org/PR27481" target="_blank">llvm.org/PR27481</a>.<br><br>Modified:<br>    llvm/trunk/lib/Target/X86/X86CallingConv.td<br>    llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll<br><br>Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=268983&r1=268982&r2=268983&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=268983&r1=268982&r2=268983&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)<br>+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon May  9 17:37:05 2016<br>@@ -897,7 +897,7 @@ def CSR_32_AllRegs_SSE : CalleeSavedRegs<br> def CSR_64_AllRegs     : CalleeSavedRegs<(add CSR_64_MostRegs, RAX, RSP,<br>                                               (sequence "XMM%u", 16, 31))>;<br> def CSR_64_AllRegs_AVX : CalleeSavedRegs<(sub (add CSR_64_MostRegs, RAX, RSP,<br>-                                                   (sequence "YMM%u", 0, 31)),<br>+                                                   (sequence "YMM%u", 0, 15)),<br>                                               (sequence "XMM%u", 0, 15))>;<br><br> // Standard C + YMM6-15<br><br>Modified: llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll?rev=268983&r1=268982&r2=268983&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll?rev=268983&r1=268982&r2=268983&view=diff</a><br>==============================================================================<br>--- llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll (original)<br>+++ llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll Mon May  9 17:37:05 2016<br>@@ -1,4 +1,4 @@<br>-; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s<br>+; RUN: llc -verify-machineinstrs -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s<br><br> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br> ;; Checks that interrupt handler code does not call "vzeroupper" instruction<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br></div></div></blockquote></div><br></div></div></div></div></blockquote></div></div></div><br></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>