[PATCH] D113302: [X86] Update IRET instruction to use the same naming convention as RET/LRET (PR36876). NFC

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 11:37:32 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: craig.topper, pengfei.
Herald added a subscriber: hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

Be more consistent in the naming convention for the various RET instructions to help prevent future scheduler model mismatches like those that were only addressed in D44687 <https://reviews.llvm.org/D44687>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113302

Files:
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86InstrControl.td
  llvm/lib/Target/X86/X86ScheduleAtom.td
  llvm/lib/Target/X86/X86ScheduleZnver1.td
  llvm/lib/Target/X86/X86ScheduleZnver2.td


Index: llvm/lib/Target/X86/X86ScheduleZnver2.td
===================================================================
--- llvm/lib/Target/X86/X86ScheduleZnver2.td
+++ llvm/lib/Target/X86/X86ScheduleZnver2.td
@@ -698,7 +698,7 @@
   let NumMicroOps = 2;
 }
 def : InstRW<[Zn2WriteRET], (instregex "RET(L|Q|W)", "LRET(L|Q|W)",
-                            "IRET(16|32|64)")>;
+                            "IRET(L|Q|W)")>;
 
 //-- Logic instructions --//
 
Index: llvm/lib/Target/X86/X86ScheduleZnver1.td
===================================================================
--- llvm/lib/Target/X86/X86ScheduleZnver1.td
+++ llvm/lib/Target/X86/X86ScheduleZnver1.td
@@ -698,7 +698,7 @@
   let NumMicroOps = 2;
 }
 def : InstRW<[ZnWriteRET], (instregex "RET(L|Q|W)", "LRET(L|Q|W)",
-                            "IRET(16|32|64)")>;
+                            "IRET(L|Q|W)")>;
 
 //-- Logic instructions --//
 
Index: llvm/lib/Target/X86/X86ScheduleAtom.td
===================================================================
--- llvm/lib/Target/X86/X86ScheduleAtom.td
+++ llvm/lib/Target/X86/X86ScheduleAtom.td
@@ -541,7 +541,7 @@
                                        PUSH16i8, PUSH32i8, PUSH64i8, PUSH64i32,
                                        XCH_F)>;
 def : InstRW<[AtomWrite0_1_1], (instregex "RETI(L|Q|W)$",
-                                          "IRET(16|32|64)?")>;
+                                          "IRET(L|Q|W)?")>;
 
 def AtomWrite0_1_5 : SchedWriteRes<[AtomPort0, AtomPort1]> {
   let Latency = 5;
Index: llvm/lib/Target/X86/X86InstrControl.td
===================================================================
--- llvm/lib/Target/X86/X86InstrControl.td
+++ llvm/lib/Target/X86/X86InstrControl.td
@@ -48,10 +48,10 @@
   // The machine return from interrupt instruction, but sometimes we need to
   // perform a post-epilogue stack adjustment. Codegen emits the pseudo form
   // which expands to include an SP adjustment if necessary.
-  def IRET16 : I   <0xcf, RawFrm, (outs), (ins), "iret{w}", []>,
+  def IRETW  : I   <0xcf, RawFrm, (outs), (ins), "iret{w}", []>,
                OpSize16;
-  def IRET32 : I   <0xcf, RawFrm, (outs), (ins), "iret{l|d}", []>, OpSize32;
-  def IRET64 : RI  <0xcf, RawFrm, (outs), (ins), "iretq", []>, Requires<[In64BitMode]>;
+  def IRETL  : I   <0xcf, RawFrm, (outs), (ins), "iret{l|d}", []>, OpSize32;
+  def IRETQ  : RI  <0xcf, RawFrm, (outs), (ins), "iretq", []>, Requires<[In64BitMode]>;
   let isCodeGenOnly = 1 in
   def IRET : PseudoI<(outs), (ins i32imm:$adj), [(X86iret timm:$adj)]>;
   def RET  : PseudoI<(outs), (ins i32imm:$adj, variable_ops), [(X86retflag timm:$adj)]>;
Index: llvm/lib/Target/X86/X86ExpandPseudo.cpp
===================================================================
--- llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -379,7 +379,7 @@
     int64_t StackAdj = MBBI->getOperand(0).getImm();
     X86FL->emitSPUpdate(MBB, MBBI, DL, StackAdj, true);
     // Replace pseudo with machine iret
-    unsigned RetOp = STI->is64Bit() ? X86::IRET64 : X86::IRET32;
+    unsigned RetOp = STI->is64Bit() ? X86::IRETQ : X86::IRETL;
     // Use UIRET if UINTR is present (except for building kernel)
     if (STI->is64Bit() && STI->hasUINTR() &&
         MBB.getParent()->getTarget().getCodeModel() != CodeModel::Kernel)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113302.385138.patch
Type: text/x-patch
Size: 3333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211105/fcbdd6ce/attachment.bin>


More information about the llvm-commits mailing list