<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;" class="">Hi Juergen (you were in the blame list for the calling convention stuff :)),<div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">For instance, the bug that this specific commit was fixing was that we pushed AVX512 registers even when AVX512 was not used.</div><div class=""><br class=""></div><div class="">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 class="">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 class=""><br class=""></div><div class="">Second, what is the default for AllRegs/MostRegs supposed to be?</div><div class="">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 class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">old.s:38:2: </b></span><span style="font-variant-ligatures: no-common-ligatures; color: #c33720" class=""><b class="">error: </b></span><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">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;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 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);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""> ^</b></span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class=""><br class=""></b></span></div><div class="">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 class=""><br class=""></div><div class=""><div class="">How would you recommend we fix this?</div></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">-Quentin</div><div class=""><div class=""><div><blockquote type="cite" class=""><div class="">On May 9, 2016, at 3:37 PM, Quentin Colombet via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: qcolombet<br class="">Date: Mon May  9 17:37:05 2016<br class="">New Revision: 268983<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=268983&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=268983&view=rev</a><br class="">Log:<br class="">[X86] Fix the AllRegs AVX calling convention.<br class=""><br class="">We used to list registers that were not in the AVX space. In other<br class="">words, we were pushing registers that the ISA cannot encode<br class="">(YMM16-YMM31).<br class=""><br class="">This is part of <a href="http://llvm.org/PR27481" class="">llvm.org/PR27481</a>.<br class=""><br class="">Modified:<br class="">    llvm/trunk/lib/Target/X86/X86CallingConv.td<br class="">    llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll<br class=""><br class="">Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=268983&r1=268982&r2=268983&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=268983&r1=268982&r2=268983&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)<br class="">+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon May  9 17:37:05 2016<br class="">@@ -897,7 +897,7 @@ def CSR_32_AllRegs_SSE : CalleeSavedRegs<br class=""> def CSR_64_AllRegs     : CalleeSavedRegs<(add CSR_64_MostRegs, RAX, RSP,<br class="">                                               (sequence "XMM%u", 16, 31))>;<br class=""> def CSR_64_AllRegs_AVX : CalleeSavedRegs<(sub (add CSR_64_MostRegs, RAX, RSP,<br class="">-                                                   (sequence "YMM%u", 0, 31)),<br class="">+                                                   (sequence "YMM%u", 0, 15)),<br class="">                                               (sequence "XMM%u", 0, 15))>;<br class=""><br class=""> // Standard C + YMM6-15<br class=""><br class="">Modified: llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll<br class="">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" class="">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 class="">==============================================================================<br class="">--- llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll (original)<br class="">+++ llvm/trunk/test/CodeGen/X86/x86-interrupt_vzeroupper.ll Mon May  9 17:37:05 2016<br class="">@@ -1,4 +1,4 @@<br class="">-; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s<br class="">+; RUN: llc -verify-machineinstrs -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s<br class=""><br class=""> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br class=""> ;; Checks that interrupt handler code does not call "vzeroupper" instruction<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>