[Android] Add another case to ThumbCompressConst

This commit is contained in:
zilmar 2016-11-22 07:51:08 +11:00
parent f46f1740c8
commit cb29d3b98e
2 changed files with 18 additions and 4 deletions

View File

@ -989,12 +989,23 @@ uint16_t CArmOps::ThumbCompressConst (uint32_t value)
{ {
return (uint16_t)((value & 0xFF)); return (uint16_t)((value & 0xFF));
} }
//'nnnnnnnn 00000000 nnnnnnnn 00000000'
if (((value >> 24) & 0xFF) == ((value >> 8) & 0xFF) &&
((value >> 16) & 0xFF) == 0 &&
(value & 0xFF) == 0)
{
return (uint16_t)(0x200 | (value & 0xFF));
}
//'nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn'
if (((value >> 24) & 0xFF) == (value & 0xFF) && if (((value >> 24) & 0xFF) == (value & 0xFF) &&
((value >> 16) & 0xFF) == (value & 0xFF) && ((value >> 16) & 0xFF) == (value & 0xFF) &&
((value >> 8) & 0xFF) == (value & 0xFF)) ((value >> 8) & 0xFF) == (value & 0xFF))
{ {
return (uint16_t)(0x300 | (value & 0xFF)); return (uint16_t)(0x300 | (value & 0xFF));
} }
CPU_Message("%s: value >> 24 = %X value >> 16 = %X value >> 8 = %X value = %X", __FUNCTION__, (value >> 24), (value >> 16), (value >> 8), value); CPU_Message("%s: value >> 24 = %X value >> 16 = %X value >> 8 = %X value = %X", __FUNCTION__, (value >> 24), (value >> 16), (value >> 8), value);
CPU_Message("%s: value = %X", __FUNCTION__, value); CPU_Message("%s: value = %X", __FUNCTION__, value);
g_Notify->BreakPoint(__FILE__,__LINE__); g_Notify->BreakPoint(__FILE__,__LINE__);

View File

@ -177,21 +177,24 @@ protected:
static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg); static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg);
static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg1, ArmReg SourceReg2); static void XorArmRegToArmReg(ArmReg DestReg, ArmReg SourceReg1, ArmReg SourceReg2);
static bool CanThumbCompressConst (uint32_t value);
static uint16_t ThumbCompressConst (uint32_t value);
static void * GetAddressOf(int32_t value, ...); static void * GetAddressOf(int32_t value, ...);
static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc); static void SetJump8(uint8_t * Loc, uint8_t * JumpLoc);
static void SetJump20(uint32_t * Loc, uint32_t * JumpLoc); static void SetJump20(uint32_t * Loc, uint32_t * JumpLoc);
static CArmRegInfo m_RegWorkingSet;
protected:
static const char * ArmBranchSuffix(ArmBranchCompare CompareType); static const char * ArmBranchSuffix(ArmBranchCompare CompareType);
static const char * ArmRegName(ArmReg Reg); static const char * ArmRegName(ArmReg Reg);
static const char * ArmFpuSingleName(ArmFpuSingle Reg); static const char * ArmFpuSingleName(ArmFpuSingle Reg);
static bool CanThumbCompressConst (uint32_t value);
static uint16_t ThumbCompressConst (uint32_t value);
static void AddCode8(uint8_t value); static void AddCode8(uint8_t value);
static void AddCode16(uint16_t value); static void AddCode16(uint16_t value);
static void AddCode32(uint32_t value); static void AddCode32(uint32_t value);
static CArmRegInfo m_RegWorkingSet;
}; };
#define AddressOf(Addr) CArmOps::GetAddressOf(5,(Addr)) #define AddressOf(Addr) CArmOps::GetAddressOf(5,(Addr))