<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 23, 2016 at 1:08 PM, Matthias Braun <span dir="ltr"><<a href="mailto:matze@braunis.de" target="_blank">matze@braunis.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><span class="gmail-"><div>On Sep 23, 2016, at 1:01 PM, Sean Silva via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br></span><div><div dir="ltr" style="font-family:helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><br><br><div class="gmail_quote"><span class="gmail-">On Tue, Sep 20, 2016 at 10:32 AM, Krzysztof Parzyszek via llvm-dev<span> </span><span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.<wbr>org</a>></span><span> </span>wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">I have posted a patch that switches the API to one that supports this (yet non-existent functionality) earlier:<br><a href="https://reviews.llvm.org/D24631" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2463<wbr>1</a><br><br>The comments from that were incorporated into the following RFC.<br><br><br>Motivation:<br><br>Certain targets feature "variable-sized" registers, i.e. a situation where the register size can be configured by a hardware switch.  A common instruction set would then operate on these registers regardless of what size they have been configured to have.  A specific example of that is the HVX coprocessor on Hexagon. HVX provides a set of vector registers, and can be configured in one of two modes: one in which vectors are 512 bits long, and one in vectors are 1024 bits in length. The size only determines the number of elements in the vector register, and so the semantics of each HVX instruction does not change: it performs a given operation on all vector elements. The encoding of the instruction does not change between modes, in fact, it is possible to have a binary that runs in both modes.<br><br>Currently the register size (strictly speaking, "spill slot size") and related properties are fixed and immutable in a RegisterClass. In order to allow multiple possible register sizes, several RegisterClass objects may need to be defined, which then will require each instruction to be defined twice. This is what the HVX code does.  Another approach may be to define several sets of physical registers corresponding to different sizes, and have a large RegisterClass which would be the union of all of them. This could avoid having to duplicate the instructions, but would lead to problems with getting the actual spill slot size or alignment.<br><br></span>Since the number of targets allowing this kind of variability is growing (besides Hexagon, there is RISC-V, MIPS, and out of tree targets, such as CHERI), LLVM should allow convenient handling of this type of a situation. See comments in<span> </span><a href="https://reviews.llvm.org/D23561" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D23561</a>for more details.<br></blockquote><span class="gmail-"><div><br></div><div>ARM SVE sounds like it will have similar issues: <a href="https://community.arm.com/groups/processors/blog/2016/08/22/technology-update-the-scalable-vector-extension-sve-for-the-armv8-a-architecture" target="_blank">https://community.arm.<wbr>com/groups/processors/blog/<wbr>2016/08/22/technology-update-<wbr>the-scalable-vector-extension-<wbr>sve-for-the-armv8-a-<wbr>architecture</a></div></span></div></div></div></div></blockquote><div><br></div><div>From glancing over the slides, it seems like SVE has dynamically sized (i.e. you don't know yet at compile time) registers which would be a step further than this.</div></div></div></blockquote><div><br></div><div>From what Krzysztof wrote, it sounds like HVX has a similar situation ("it is possible to have a binary that runs in both modes"). </div><div><br></div><div>-- Sean Silva</div><div><br></div><div><br></div><div> </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="word-wrap:break-word"><div><div> Of course the stuff in here wouldn't hurt for that as it  pushes the code into a direction to rely less on well-known/fixed register sizes.</div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>- Matthias</div></font></span></div><br></div></blockquote></div><br></div></div>