[llvm] r314248 - [X86] Don't emit X86::MOV8rr_NOREX from X86InstrInfo::copyPhysReg.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 14:35:06 PDT 2017


Author: ctopper
Date: Tue Sep 26 14:35:06 2017
New Revision: 314248

URL: http://llvm.org/viewvc/llvm-project?rev=314248&view=rev
Log:
[X86] Don't emit X86::MOV8rr_NOREX from X86InstrInfo::copyPhysReg.

This hook is called after register allocation with two physical registers. We don't need a separate instruction at that time to force register class constraints. I left in the assert though. We also have a fatal error in X86MCCodeEmitter if we ever encode an H-reg and a REX prefix.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=314248&r1=314247&r2=314248&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Sep 26 14:35:06 2017
@@ -6600,16 +6600,14 @@ void X86InstrInfo::copyPhysReg(MachineBa
   else if (X86::GR16RegClass.contains(DestReg, SrcReg))
     Opc = X86::MOV16rr;
   else if (X86::GR8RegClass.contains(DestReg, SrcReg)) {
-    // Copying to or from a physical H register on x86-64 requires a NOREX
-    // move.  Otherwise use a normal move.
-    if ((isHReg(DestReg) || isHReg(SrcReg)) &&
-        Subtarget.is64Bit()) {
-      Opc = X86::MOV8rr_NOREX;
+    // Copying to or from a physical H register on x86-64 must ensure it
+    // doesn't require a REX prefix for the other register.
+    if ((isHReg(DestReg) || isHReg(SrcReg)) && Subtarget.is64Bit()) {
       // Both operands must be encodable without an REX prefix.
       assert(X86::GR8_NOREXRegClass.contains(SrcReg, DestReg) &&
              "8-bit H register can not be copied outside GR8_NOREX");
-    } else
-      Opc = X86::MOV8rr;
+    }
+    Opc = X86::MOV8rr;
   }
   else if (X86::VR64RegClass.contains(DestReg, SrcReg))
     Opc = X86::MMX_MOVQ64rr;




More information about the llvm-commits mailing list