Use GR32 for copies between GR32_NOSP and GR32_NOREX, as neither
authorDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 22:18:26 +0000 (22:18 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 5 Aug 2009 22:18:26 +0000 (22:18 +0000)
is a subset of the other, but both are subsets of GR32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78250 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index 784a790eb00904301b6312b2bb6811af7d5a816d..393bd5c2ca06a37cb9b0687e963e19a11e75d96b 100644 (file)
@@ -1697,10 +1697,18 @@ bool X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
     CommonRC = SrcRC;
   else if (!DestRC->hasSubClass(SrcRC)) {
     // Neither of GR64_NOREX or GR64_NOSP is a superclass of the other,
-    // but we want to copy then as GR64.
-    if ((SrcRC == &X86::GR64RegClass || SrcRC->hasSuperClass(&X86::GR64RegClass)) &&
-        (DestRC == &X86::GR64RegClass || DestRC->hasSuperClass(&X86::GR64RegClass)))
+    // but we want to copy then as GR64. Similarly, for GR32_NOREX and
+    // GR32_NOSP, copy as GR32.
+    if ((SrcRC == &X86::GR64RegClass ||
+         SrcRC->hasSuperClass(&X86::GR64RegClass)) &&
+        (DestRC == &X86::GR64RegClass ||
+         DestRC->hasSuperClass(&X86::GR64RegClass)))
       CommonRC = &X86::GR64RegClass;
+    else if ((SrcRC == &X86::GR32RegClass ||
+              SrcRC->hasSuperClass(&X86::GR32RegClass)) &&
+             (DestRC == &X86::GR32RegClass ||
+              DestRC->hasSuperClass(&X86::GR32RegClass)))
+      CommonRC = &X86::GR32RegClass;
     else
       CommonRC = 0;
   }