diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-07-20 14:52:44 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-07-20 14:52:44 -0700 |
commit | 0781609693ef3ec0ee12aa6031c62d8a2e67d49c (patch) | |
tree | 1fdde601ed31e1f4f46317b595472521238efbb9 /src | |
parent | cfadef74d1d7ce47d0bd30a14a509a15a354849a (diff) | |
download | gem5-0781609693ef3ec0ee12aa6031c62d8a2e67d49c.tar.xz |
Fixed width parameter and provided a parameter to flip the carry bit on subtract.
--HG--
extra : convert_revision : d01bb791b000a2fdfc8600f8fb2f8aadd52b0b63
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/insts/microregop.cc | 30 | ||||
-rw-r--r-- | src/arch/x86/insts/microregop.hh | 3 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/arch/x86/insts/microregop.cc b/src/arch/x86/insts/microregop.cc index f4559d95f..976b04688 100644 --- a/src/arch/x86/insts/microregop.cc +++ b/src/arch/x86/insts/microregop.cc @@ -63,24 +63,32 @@ namespace X86ISA { uint64_t RegOpBase::genFlags(uint64_t oldFlags, uint64_t flagMask, - uint64_t _dest, uint64_t _src1, uint64_t _src2) const + uint64_t _dest, uint64_t _src1, uint64_t _src2, + bool subtract) const { + DPRINTF(Sparc, "flagMask = %#x\n", flagMask); uint64_t flags = oldFlags & ~flagMask; - if(flagMask & CFBit && findCarry(dataSize, _dest, _src1, _src2)) - flags |= CFBit; - if(flagMask & PFBit && findParity(dataSize, _dest)) + if(flagMask & CFBit) + if(findCarry(dataSize*8, _dest, _src1, _src2)) + flags |= CFBit; + if(subtract) + flags ^= CFBit; + if(flagMask & PFBit && findParity(dataSize*8, _dest)) flags |= PFBit; - if(flagMask & ECFBit && findCarry(dataSize, _dest, _src1, _src2)) + if(flagMask & ECFBit && findCarry(dataSize*8, _dest, _src1, _src2)) flags |= ECFBit; - if(flagMask & AFBit && findCarry(4, _dest, _src1, _src2)) - flags |= AFBit; - if(flagMask & EZFBit && findZero(dataSize, _dest)) + if(flagMask & AFBit) + if(findCarry(4, _dest, _src1, _src2)) + flags |= AFBit; + if(subtract) + flags ^= AFBit; + if(flagMask & EZFBit && findZero(dataSize*8, _dest)) flags |= EZFBit; - if(flagMask & ZFBit && findZero(dataSize, _dest)) + if(flagMask & ZFBit && findZero(dataSize*8, _dest)) flags |= ZFBit; - if(flagMask & SFBit && findNegative(dataSize, _dest)) + if(flagMask & SFBit && findNegative(dataSize*8, _dest)) flags |= SFBit; - if(flagMask & OFBit && findOverflow(dataSize, _dest, _src1, _src2)) + if(flagMask & OFBit && findOverflow(dataSize*8, _dest, _src1, _src2)) flags |= OFBit; return flags; } diff --git a/src/arch/x86/insts/microregop.hh b/src/arch/x86/insts/microregop.hh index a8049ba19..f411c0775 100644 --- a/src/arch/x86/insts/microregop.hh +++ b/src/arch/x86/insts/microregop.hh @@ -132,7 +132,8 @@ namespace X86ISA //Figure out what the condition code flags should be. uint64_t genFlags(uint64_t oldFlags, uint64_t flagMask, - uint64_t _dest, uint64_t _src1, uint64_t _src2) const; + uint64_t _dest, uint64_t _src1, uint64_t _src2, + bool subtract = false) const; bool checkCondition(uint64_t flags) const; }; |