X86: Handle left rotations that go all the way around or more.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 09:58:54 +0000 (02:58 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 09:58:54 +0000 (02:58 -0700)
src/arch/x86/isa/microops/regop.isa

index 5461223a3a91816289a6ee0245c074e0eebdd2cf..447939abdcc324026bbcc2b9023f6d87b610def9 100644 (file)
@@ -796,11 +796,12 @@ let {{
         code = '''
             uint8_t shiftAmt =
                 (op2 & ((dataSize == 8) ? mask(6) : mask(5)));
-            if(shiftAmt)
+            uint8_t realShiftAmt = shiftAmt % (dataSize * 8);
+            if(realShiftAmt)
             {
-                uint64_t top = psrc1 << shiftAmt;
+                uint64_t top = psrc1 << realShiftAmt;
                 uint64_t bottom =
-                    bits(psrc1, dataSize * 8 - 1, dataSize * 8 - shiftAmt);
+                    bits(psrc1, dataSize * 8 - 1, dataSize * 8 - realShiftAmt);
                 DestReg = merge(DestReg, top | bottom, dataSize);
             }
             else