From b0991e061caaa03a800cb4266dc441bdf1dd2554 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 27 Sep 2017 20:34:13 +0000 Subject: [PATCH] Revert r314248 "[X86] Don't emit X86::MOV8rr_NOREX from X86InstrInfo::copyPhysReg." This contributed to PR34751 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314338 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrInfo.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index bbdba05bee61..6638c3bb2ac6 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -6600,14 +6600,16 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB, 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 must ensure it - // doesn't require a REX prefix for the other register. - if ((isHReg(DestReg) || isHReg(SrcReg)) && Subtarget.is64Bit()) { + // 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; // 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"); - } - Opc = X86::MOV8rr; + } else + Opc = X86::MOV8rr; } else if (X86::VR64RegClass.contains(DestReg, SrcReg)) Opc = X86::MMX_MOVQ64rr;