From 7c63bd189375bba24f5af7703ee765fc7fc88708 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 22 May 2022 17:33:12 -0700 Subject: [PATCH] docs/DSP: Fix inconsistency with ADDI and CMPI We don't have anything called $amD, though we do have $acsD. However, these instructions affect flags based on the whole accumulator, so it's better to just use $acD. --- .../Core/Core/DSP/Interpreter/DSPIntArithmetic.cpp | 13 +++++++------ Source/Core/Core/DSP/Jit/x64/DSPJitArithmetic.cpp | 11 ++++++----- .../GameCube_DSP_Users_Manual.tex | 8 ++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/DSP/Interpreter/DSPIntArithmetic.cpp b/Source/Core/Core/DSP/Interpreter/DSPIntArithmetic.cpp index 5ada6bb669..0a9485b0ab 100644 --- a/Source/Core/Core/DSP/Interpreter/DSPIntArithmetic.cpp +++ b/Source/Core/Core/DSP/Interpreter/DSPIntArithmetic.cpp @@ -143,11 +143,12 @@ void Interpreter::cmpaxh(const UDSPInstruction opc) ZeroWriteBackLog(); } -// CMPI $amD, #I +// CMPI $acD, #I // 0000 001d 1000 0000 // iiii iiii iiii iiii -// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I. -// Although flags are being set regarding whole accumulator register. +// Compares accumulator with immediate. Comparison is executed +// by subtracting the immediate (16-bit sign extended) from mid accumulator +// $acD.hm and computing flags based on whole accumulator $acD. // // flags out: x-xx xxxx void Interpreter::cmpi(const UDSPInstruction opc) @@ -166,8 +167,8 @@ void Interpreter::cmpi(const UDSPInstruction opc) // CMPIS $acD, #I // 0000 011d iiii iiii -// Compares accumulator with short immediate. Comaprison is executed -// by subtracting short immediate (8bit sign extended) from mid accumulator +// Compares accumulator with short immediate. Comparison is executed +// by subtracting the short immediate (8-bit sign extended) from mid accumulator // $acD.hm and computing flags based on whole accumulator $acD. // // flags out: x-xx xxxx @@ -489,7 +490,7 @@ void Interpreter::addaxl(const UDSPInstruction opc) UpdateSR64Add(acc, acx, GetLongAcc(dreg)); } -// ADDI $amD, #I +// ADDI $acD, #I // 0000 001d 0000 0000 // iiii iiii iiii iiii // Adds immediate (16-bit sign extended) to mid accumulator $acD.hm. diff --git a/Source/Core/Core/DSP/Jit/x64/DSPJitArithmetic.cpp b/Source/Core/Core/DSP/Jit/x64/DSPJitArithmetic.cpp index a0185f73a2..e2627f0e85 100644 --- a/Source/Core/Core/DSP/Jit/x64/DSPJitArithmetic.cpp +++ b/Source/Core/Core/DSP/Jit/x64/DSPJitArithmetic.cpp @@ -220,11 +220,12 @@ void DSPEmitter::cmpaxh(const UDSPInstruction opc) } } -// CMPI $amD, #I +// CMPI $acD, #I // 0000 001d 1000 0000 // iiii iiii iiii iiii -// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I. -// Although flags are being set regarding whole accumulator register. +// Compares accumulator with immediate. Comparison is executed +// by subtracting the immediate (16-bit sign extended) from mid accumulator +// $acD.hm and computing flags based on whole accumulator $acD. // // flags out: x-xx xxxx void DSPEmitter::cmpi(const UDSPInstruction opc) @@ -257,7 +258,7 @@ void DSPEmitter::cmpi(const UDSPInstruction opc) // CMPIS $acD, #I // 0000 011d iiii iiii // Compares accumulator with short immediate. Comparison is executed -// by subtracting short immediate (8bit sign extended) from mid accumulator +// by subtracting the short immediate (8-bit sign extended) from mid accumulator // $acD.hm and computing flags based on whole accumulator $acD. // // flags out: x-xx xxxx @@ -686,7 +687,7 @@ void DSPEmitter::addaxl(const UDSPInstruction opc) } } -// ADDI $amD, #I +// ADDI $acD, #I // 0000 001d 0000 0000 // iiii iiii iiii iiii // Adds immediate (16-bit sign extended) to mid accumulator $acD.hm. diff --git a/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex b/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex index 97d4da1aea..5218829044 100644 --- a/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex +++ b/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex @@ -1222,7 +1222,7 @@ A ``-'' indicates that the flag retains its previous value, a ``0'' indicates th \end{DSPOpcodeBytefield} \begin{DSPOpcodeFormat} - ADDI $amD, #I + ADDI $acD, #I \end{DSPOpcodeFormat} \begin{DSPOpcodeDescription} @@ -1958,12 +1958,12 @@ A ``-'' indicates that the flag retains its previous value, a ``0'' indicates th \end{DSPOpcodeBytefield} \begin{DSPOpcodeFormat} - CMPI $amD, #I + CMPI $acD, #I \end{DSPOpcodeFormat} \begin{DSPOpcodeDescription} - \item Compares mid accumulator \Register{\$acD.hm} (\Register{\$amD}) with sign-extended immediate value \Value{I}. - However, flags are set with regards to the whole accumulator register. + \item Compares accumulator with immediate. Comparison is performed by subtracting the immediate (16-bit sign-extended) + from mid accumulator \Register{\$acD.hm} and computing flags based on whole accumulator \Register{\$acD}. \end{DSPOpcodeDescription} \begin{DSPOpcodeOperation}