CPU/Recompiler: Extend sign for add/sub/cmp immediates in AArch64
This commit is contained in:
@ -4,8 +4,8 @@
|
||||
#include "cpu_types.h"
|
||||
|
||||
#include <array>
|
||||
#include <tuple>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
|
||||
namespace CPU::Recompiler {
|
||||
|
||||
@ -137,6 +137,26 @@ struct Value
|
||||
return Value();
|
||||
}
|
||||
|
||||
/// Returns the constant value as a signed 64-bit integer, suitable as an immediate.
|
||||
s64 GetS64ConstantValue() const
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case RegSize_8:
|
||||
return static_cast<s64>(SignExtend64(Truncate8(constant_value)));
|
||||
|
||||
case RegSize_16:
|
||||
return static_cast<s64>(SignExtend64(Truncate16(constant_value)));
|
||||
|
||||
case RegSize_32:
|
||||
return static_cast<s64>(SignExtend64(Truncate32(constant_value)));
|
||||
|
||||
case RegSize_64:
|
||||
default:
|
||||
return static_cast<s64>(constant_value);
|
||||
}
|
||||
}
|
||||
|
||||
static Value FromHostReg(RegisterCache* regcache, HostReg reg, RegSize size)
|
||||
{
|
||||
return Value(regcache, reg, size, ValueFlags::Valid | ValueFlags::InHostRegister);
|
||||
|
||||
Reference in New Issue
Block a user