changeset 1e4908b3e28e in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=1e4908b3e28e
description:
        X86: Shift some register flattening work into the decoder.

diffstat:

4 files changed, 21 insertions(+), 28 deletions(-)
src/arch/x86/insts/static_inst.cc |    3 ---
src/arch/x86/intregs.hh           |    6 +++++-
src/arch/x86/isa.cc               |   22 ----------------------
src/arch/x86/isa.hh               |   18 ++++++++++++++++--

diffs (109 lines):

diff -r 389dbee088d2 -r 1e4908b3e28e src/arch/x86/insts/static_inst.cc
--- a/src/arch/x86/insts/static_inst.cc Thu Jul 16 15:40:48 2009 -0500
+++ b/src/arch/x86/insts/static_inst.cc Fri Jul 17 00:29:42 2009 -0700
@@ -153,10 +153,7 @@
             reg &= ~(1 << 6);
 
             if(fold)
-            {
                 suffix = "h";
-                reg -= 4;
-            }
             else if(reg < 8 && size == 1)
                 suffix = "l";
 
diff -r 389dbee088d2 -r 1e4908b3e28e src/arch/x86/intregs.hh
--- a/src/arch/x86/intregs.hh   Thu Jul 16 15:40:48 2009 -0500
+++ b/src/arch/x86/intregs.hh   Fri Jul 17 00:29:42 2009 -0700
@@ -60,6 +60,8 @@
 
 #include "arch/x86/x86_traits.hh"
 #include "base/bitunion.hh"
+#include "base/misc.hh"
+#include "sim/core.hh"
 
 namespace X86ISA
 {
@@ -187,7 +189,9 @@
     inline static IntRegIndex
     INTREG_FOLDED(int index, int foldBit)
     {
-        return (IntRegIndex)(((index & 0x1C) == 4 ? foldBit : 0) | index);
+        if ((index & 0x1C) == 4 && foldBit)
+            index = (index - 4) | foldBit;
+        return (IntRegIndex)index;
     }
 };
 
diff -r 389dbee088d2 -r 1e4908b3e28e src/arch/x86/isa.cc
--- a/src/arch/x86/isa.cc       Thu Jul 16 15:40:48 2009 -0500
+++ b/src/arch/x86/isa.cc       Fri Jul 17 00:29:42 2009 -0700
@@ -28,7 +28,6 @@
  * Authors: Gabe Black
  */
 
-#include "arch/x86/floatregs.hh"
 #include "arch/x86/isa.hh"
 #include "arch/x86/tlb.hh"
 #include "cpu/base.hh"
@@ -355,25 +354,4 @@
     UNSERIALIZE_ARRAY(regVal, NumMiscRegs);
 }
 
-int
-ISA::flattenIntIndex(int reg)
-{
-    //If we need to fold over the index to match byte semantics, do that.
-    //Otherwise, just strip off any extra bits and pass it through.
-    if (reg & (1 << 6))
-        return (reg & (~(1 << 6) - 0x4));
-    else
-        return (reg & ~(1 << 6));
 }
-
-int
-ISA::flattenFloatIndex(int reg)
-{
-    if (reg >= NUM_FLOATREGS) {
-        int top = readMiscRegNoEffect(MISCREG_X87_TOP);
-        reg = FLOATREG_STACK(reg - NUM_FLOATREGS, top);
-    }
-    return reg;
-}
-
-}
diff -r 389dbee088d2 -r 1e4908b3e28e src/arch/x86/isa.hh
--- a/src/arch/x86/isa.hh       Thu Jul 16 15:40:48 2009 -0500
+++ b/src/arch/x86/isa.hh       Fri Jul 17 00:29:42 2009 -0700
@@ -31,6 +31,7 @@
 #ifndef __ARCH_X86_ISA_HH__
 #define __ARCH_X86_ISA_HH__
 
+#include "arch/x86/floatregs.hh"
 #include "arch/x86/miscregs.hh"
 #include "arch/x86/registers.hh"
 #include "base/types.hh"
@@ -65,8 +66,21 @@
         void setMiscRegNoEffect(int miscReg, MiscReg val);
         void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc);
 
-        int flattenIntIndex(int reg);
-        int flattenFloatIndex(int reg);
+        int
+        flattenIntIndex(int reg)
+        {
+            return reg & ~(1 << 6);
+        }
+
+        int
+        flattenFloatIndex(int reg)
+        {
+            if (reg >= NUM_FLOATREGS) {
+                reg = FLOATREG_STACK(reg - NUM_FLOATREGS,
+                                     regVal[MISCREG_X87_TOP]);
+            }
+            return reg;
+        }
 
         void serialize(EventManager *em, std::ostream &os);
         void unserialize(EventManager *em, Checkpoint *cp,
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to