X86: Fix how ECF is computed in genFlags, and get rid of some duplicate code.
authorGabe Black <gblack@eecs.umich.edu>
Thu, 13 Sep 2007 23:35:41 +0000 (16:35 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Thu, 13 Sep 2007 23:35:41 +0000 (16:35 -0700)
--HG--
extra : convert_revision : f86330a5a9fea782ee63aaa18ca964fb6f9cef0b

src/arch/x86/insts/microregop.cc
src/arch/x86/isa/insts/processor_information.py

index b6a30d6a7b2d078050ec15a141b42c2f9eecd3c2..ad48a4bc18fcfd2ccd72eee9f752c09be1aa56d7 100644 (file)
@@ -68,17 +68,15 @@ namespace X86ISA
     {
         DPRINTF(Sparc, "flagMask = %#x\n", flagMask);
         uint64_t flags = oldFlags & ~flagMask;
-        if(flagMask & CFBit)
+        if(flagMask & (ECFBit | CFBit))
         {
             if(findCarry(dataSize*8, _dest, _src1, _src2))
-                flags |= CFBit;
+                flags |= (flagMask & (ECFBit | CFBit));
             if(subtract)
-                flags ^= CFBit;
+                flags ^= (flagMask & (ECFBit | CFBit));
         }
         if(flagMask & PFBit && findParity(dataSize*8, _dest))
             flags |= PFBit;
-        if(flagMask & ECFBit && findCarry(dataSize*8, _dest, _src1, _src2))
-            flags |= ECFBit;
         if(flagMask & AFBit)
         {
             if(findCarry(4, _dest, _src1, _src2))
@@ -86,10 +84,8 @@ namespace X86ISA
             if(subtract)
                 flags ^= AFBit;
         }
-        if(flagMask & EZFBit && findZero(dataSize*8, _dest))
-            flags |= EZFBit;
-        if(flagMask & ZFBit && findZero(dataSize*8, _dest))
-            flags |= ZFBit;
+        if(flagMask & (EZFBit | ZFBit) && findZero(dataSize*8, _dest))
+            flags |= (flagMask & (EZFBit | ZFBit));
         if(flagMask & SFBit && findNegative(dataSize*8, _dest))
             flags |= SFBit;
         if(flagMask & OFBit && findOverflow(dataSize*8, _dest, _src1, _src2))
index 9cad8181c845ada5f2fd48a07452d4b01274bb05..6070169ac766d4e9254196b9f1d496dc4664edb0 100644 (file)
@@ -74,7 +74,7 @@ def macroop CPUID_R {
     movi t2, t2, 0x18, flags=(nCEZF,)
     subi t0, t1, t2, flags=(ECF,)
     # ECF will be set if the offset is too large.
-    bri t0, label("end"), flags=(CECF,)
+    bri t0, label("end"), flags=(nCECF,)
 
 
 #