changeset 755cf9b6185f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=755cf9b6185f
description:
X86: Handle rotate right with carry instructions that go all the way
around or more.
diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
src/arch/x86/isa/microops/regop.isa | 16 ++++++++++------
diffs (36 lines):
diff -r 1d4dbb357560 -r 755cf9b6185f src/arch/x86/isa/microops/regop.isa
--- a/src/arch/x86/isa/microops/regop.isa Wed Aug 05 03:01:23 2009 -0700
+++ b/src/arch/x86/isa/microops/regop.isa Wed Aug 05 03:01:49 2009 -0700
@@ -762,13 +762,14 @@
code = '''
uint8_t shiftAmt =
(op2 & ((dataSize == 8) ? mask(6) : mask(5)));
- if(shiftAmt)
+ uint8_t realShiftAmt = shiftAmt % (dataSize * 8 + 1);
+ if(realShiftAmt)
{
CCFlagBits flags = ccFlagBits;
- uint64_t top = flags.cf << (dataSize * 8 - shiftAmt);
- if(shiftAmt > 1)
- top |= psrc1 << (dataSize * 8 - shiftAmt + 1);
- uint64_t bottom = bits(psrc1, dataSize * 8 - 1, shiftAmt);
+ uint64_t top = flags.cf << (dataSize * 8 - realShiftAmt);
+ if (realShiftAmt > 1)
+ top |= psrc1 << (dataSize * 8 - realShiftAmt + 1);
+ uint64_t bottom = bits(psrc1, dataSize * 8 - 1, realShiftAmt);
DestReg = merge(DestReg, top | bottom, dataSize);
}
else
@@ -787,8 +788,11 @@
ccFlagBits = ccFlagBits | OFBit;
}
//If some combination of the CF bits need to be set, set them.
- if ((ext & (CFBit | ECFBit)) && bits(SrcReg1, shiftAmt - 1))
+ if ((ext & (CFBit | ECFBit)) &&
+ (realShiftAmt == 0) ? origCFBit :
+ bits(SrcReg1, realShiftAmt - 1)) {
ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
+ }
//Use the regular mechanisms to calculate the other flags.
ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit |
OFBit),
DestReg, psrc1, op2);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev