X86: Handle rotating right all the way around or more.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 10:00:03 +0000 (03:00 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 5 Aug 2009 10:00:03 +0000 (03:00 -0700)
src/arch/x86/isa/microops/regop.isa

index 85fe8fe5170107db527a8e4195e741ed947803c4..2514be91a0a189dfa7cab3b3628548440e6d8d8c 100644 (file)
@@ -727,10 +727,11 @@ 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 << (dataSize * 8 - shiftAmt);
-                uint64_t bottom = bits(psrc1, dataSize * 8, shiftAmt);
+                uint64_t top = psrc1 << (dataSize * 8 - realShiftAmt);
+                uint64_t bottom = bits(psrc1, dataSize * 8, realShiftAmt);
                 DestReg = merge(DestReg, top | bottom, dataSize);
             }
             else