regop.isa (6454:755cf9b6185f) regop.isa (6456:57e6d35dde10)
1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

--- 825 unchanged lines hidden (view full) ---

834 DestReg, psrc1, op2);
835 }
836 '''
837
838 class Rcl(RegOp):
839 code = '''
840 uint8_t shiftAmt =
841 (op2 & ((dataSize == 8) ? mask(6) : mask(5)));
1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

--- 825 unchanged lines hidden (view full) ---

834 DestReg, psrc1, op2);
835 }
836 '''
837
838 class Rcl(RegOp):
839 code = '''
840 uint8_t shiftAmt =
841 (op2 & ((dataSize == 8) ? mask(6) : mask(5)));
842 if(shiftAmt)
842 uint8_t realShiftAmt = shiftAmt % (dataSize * 8 + 1);
843 if(realShiftAmt)
843 {
844 CCFlagBits flags = ccFlagBits;
844 {
845 CCFlagBits flags = ccFlagBits;
845 uint64_t top = psrc1 << shiftAmt;
846 uint64_t bottom = flags.cf << (shiftAmt - 1);
846 uint64_t top = psrc1 << realShiftAmt;
847 uint64_t bottom = flags.cf << (realShiftAmt - 1);
847 if(shiftAmt > 1)
848 bottom |=
849 bits(psrc1, dataSize * 8 - 1,
848 if(shiftAmt > 1)
849 bottom |=
850 bits(psrc1, dataSize * 8 - 1,
850 dataSize * 8 - shiftAmt + 1);
851 dataSize * 8 - realShiftAmt + 1);
851 DestReg = merge(DestReg, top | bottom, dataSize);
852 }
853 else
854 DestReg = merge(DestReg, DestReg, dataSize);
855 '''
856 flag_code = '''
857 // If the shift amount is zero, no flags should be modified.
858 if (shiftAmt) {
852 DestReg = merge(DestReg, top | bottom, dataSize);
853 }
854 else
855 DestReg = merge(DestReg, DestReg, dataSize);
856 '''
857 flag_code = '''
858 // If the shift amount is zero, no flags should be modified.
859 if (shiftAmt) {
860 int origCFBit = (ccFlagBits & CFBit) ? 1 : 0;
859 //Zero out any flags we might modify. This way we only have to
860 //worry about setting them.
861 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
862 int msb = bits(DestReg, dataSize * 8 - 1);
861 //Zero out any flags we might modify. This way we only have to
862 //worry about setting them.
863 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
864 int msb = bits(DestReg, dataSize * 8 - 1);
863 int CFBits = bits(SrcReg1, dataSize * 8 - shiftAmt);
865 int CFBits = bits(SrcReg1, dataSize * 8 - realShiftAmt);
864 //If some combination of the CF bits need to be set, set them.
866 //If some combination of the CF bits need to be set, set them.
865 if ((ext & (CFBit | ECFBit)) && CFBits)
867 if ((ext & (CFBit | ECFBit)) &&
868 (realShiftAmt == 0) ? origCFBit : CFBits)
866 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
867 //Figure out what the OF bit should be.
868 if ((ext & OFBit) && (msb ^ CFBits))
869 ccFlagBits = ccFlagBits | OFBit;
870 //Use the regular mechanisms to calculate the other flags.
871 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit),
872 DestReg, psrc1, op2);
873 }

--- 444 unchanged lines hidden ---
869 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
870 //Figure out what the OF bit should be.
871 if ((ext & OFBit) && (msb ^ CFBits))
872 ccFlagBits = ccFlagBits | OFBit;
873 //Use the regular mechanisms to calculate the other flags.
874 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit),
875 DestReg, psrc1, op2);
876 }

--- 444 unchanged lines hidden ---