<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Have you tried working with AltOrders (see Target.td)?
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">It seems suitable for your needs.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Dvir<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org]
<b>On Behalf Of </b>Davis, Alan via llvm-dev<br>
<b>Sent:</b> Wednesday, January 17, 2018 22:31<br>
<b>To:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> [Digital Signature Failure] [llvm-dev] Opcodes with 32-bit pair vs 64-bit register<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Mark, did you get anywhere with this? We have a similar issue, where a family of otherwise-identical instructions operates on different register classes depending on a non-static property -- functional unit selection in our case.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I started to head down the path of using multidefs but quickly abandoned that. I had envisioned a MachineOperand that would hold the functional unit assignment, and having a pass that used that to set up register constraints rather than
 getting them from the static tables.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For your case, can you not simply define the two 32-bit halves as subregisters of the 64-bit class?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">-Alan<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">From: Mark Schimmel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><o:p></o:p></p>
<p class="MsoNormal">To: "<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><o:p></o:p></p>
<p class="MsoNormal">Subject: [llvm-dev] Opcodes with 32-bit pair vs 64-bit register<o:p></o:p></p>
<p class="MsoNormal">                operands<o:p></o:p></p>
<p class="MsoNormal">Message-ID:<o:p></o:p></p>
<p class="MsoNormal">                <<a href="mailto:549704409B55EF4EA338DE0614245F4401575B233E@us01wembx1.internal.synopsys.com">549704409B55EF4EA338DE0614245F4401575B233E@us01wembx1.internal.synopsys.com</a>><o:p></o:p></p>
<p class="MsoNormal">                <o:p></o:p></p>
<p class="MsoNormal">Content-Type: text/plain; charset="utf-8"<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can anyone suggest how to define an opcode that takes a pair of registers on a 32-bit architecture but a single 64-bit wide register on a 64-bit architecture? For example, the following instruction converts a double to a single. The source
 operand is a register of class "Pair64". Is there a way to define it such that the register class is defined at runtime when we know if it should be a 64-bit register class?<o:p></o:p></p>
<p class="MsoNormal">def FD2S_rr: RRX<0b00110,0,0,0, (outs Core32:$a), (ins Pair64:$b),<o:p></o:p></p>
<p class="MsoNormal">               "FD2S\t$a,$b"),[(set f32:$a, (fpround f64:$b))]>; Example register classes:<o:p></o:p></p>
<p class="MsoNormal">def Core32: RegisterClass<"XYZ", [i32,f32], 32,<o:p></o:p></p>
<p class="MsoNormal">               (add R0,R1,R2,R3,...<o:p></o:p></p>
<p class="MsoNormal">def Pair64: RegisterClass<"XYZ", [i64,f64], 64,...<o:p></o:p></p>
<p class="MsoNormal">               (add R0R1, R2R3,...<o:p></o:p></p>
<p class="MsoNormal">def WideCore : RegisterClass<"XYZ", [i64,f64], 64,<o:p></o:p></p>
<p class="MsoNormal">               (add R0_64, R1_64 ...<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">def R0 : Core<0, "%r0">, DwarfRegNum<[0]>; def R1 : Core<1, "%r1">, DwarfRegNum<[1]>; def R2 : Core<2, "%r2">, DwarfRegNum<[2]>; def R3 : Core<3, "%r3">, DwarfRegNum<[3]>; def R0R1 : CorePair<0,"%r0",[R0,R1] >; def R2R3 : CorePair<2,"%r2",[R2,R3]
 >; def R0_64 : Core64<0, "%r0", [R0]>, DwarfRegNum<[0]>; def R1_64 : Core64<1, "%r1", [R1]>, DwarfRegNum<[1]>;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As I understand it, tablegen emits static tables with hard references to register classes and such. I fear that I'll need to duplicate all the opcodes that have Pair64 operands and define identical ones with WideCore operands. I can imagine
 changing the tablegen backend to emit tables with dynamic initializers.<o:p></o:p></p>
</div>
</body>
</html>