summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2017-08-11 19:55:08 +0200
committerGitHub <noreply@github.com>2017-08-11 19:55:08 +0200
commit0a8e1bd864947fdd67c7d7fcd006917cf98b3267 (patch)
treec73aea6fbac40016acd81eb6802322b5c2d183fe /Source/Core
parent57673096703261bbca63719eb205988daa21d0b8 (diff)
parentb89e4b52581df8785d593e15c7ad6ee6d0eaebed (diff)
Merge pull request #5916 from degasus/cmp
Interpreter: Fix cmpi.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter.h1
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp23
2 files changed, 16 insertions, 8 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
index 0ce65ba149..a10251cc36 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h
@@ -287,7 +287,6 @@ private:
// flag helper
static void Helper_UpdateCR0(u32 value);
static void Helper_UpdateCR1();
- static void Helper_UpdateCRx(int x, u32 value);
// address helper
static u32 Helper_Get_EA(const UGeckoInstruction inst);
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
index 65b8547b98..e8731b8c2a 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp
@@ -12,16 +12,11 @@
void Interpreter::Helper_UpdateCR0(u32 value)
{
- Helper_UpdateCRx(0, value);
-}
-
-void Interpreter::Helper_UpdateCRx(int idx, u32 value)
-{
s64 sign_extended = (s64)(s32)value;
u64 cr_val = (u64)sign_extended;
cr_val = (cr_val & ~(1ull << 61)) | ((u64)GetXER_SO() << 61);
- PowerPC::ppcState.cr_val[idx] = cr_val;
+ PowerPC::ppcState.cr_val[0] = cr_val;
}
u32 Interpreter::Helper_Carry(u32 value1, u32 value2)
@@ -89,7 +84,21 @@ void Interpreter::andis_rc(UGeckoInstruction inst)
void Interpreter::cmpi(UGeckoInstruction inst)
{
- Helper_UpdateCRx(inst.CRFD, rGPR[inst.RA] - inst.SIMM_16);
+ s32 a = rGPR[inst.RA];
+ s32 b = inst.SIMM_16;
+ int f;
+
+ if (a < b)
+ f = 0x8;
+ else if (a > b)
+ f = 0x4;
+ else
+ f = 0x2; // equals
+
+ if (GetXER_SO())
+ f |= 0x1;
+
+ SetCRField(inst.CRFD, f);
}
void Interpreter::cmpli(UGeckoInstruction inst)