diff --git a/source/tests/cpu/integer.cpp b/source/tests/cpu/integer.cpp index d0d072a..c30e8e4 100644 --- a/source/tests/cpu/integer.cpp +++ b/source/tests/cpu/integer.cpp @@ -146,6 +146,27 @@ static bool Usad8() { return true; } +// USADA8 +static bool Usada8() { + unsigned int output; + unsigned int rm = 50; + unsigned int rn = 10; + unsigned int ra = 1; + + // Regular subtraction with accumulator add: abs(50 - 10) + 1 + asm volatile ("USADA8 %[out], %[Rm], %[Rn], %[Ra]" : [out] "=r"(output) : [Rm] "r"(rm), [Rn] "r"(rn), [Ra] "r"(ra)); + SoftAssert(output == 41); + + // Absolute value subtraction with accumulator add: abs(0 - 1) + 9 + rm = 0; + rn = 1; + ra = 9; + asm volatile ("USADA8 %[out], %[Rm], %[Rn], %[Ra]" : [out] "=r"(output) : [Rm] "r"(rm), [Rn] "r"(rn), [Ra] "r"(ra)); + SoftAssert(output == 10); + + return true; +} + // UXTAB16 static bool Uxtab16() { unsigned int output; @@ -198,6 +219,7 @@ static bool Uxtb16() { return true; } + void TestAll() { const std::string tag = "Integer"; @@ -208,6 +230,7 @@ void TestAll() { Test(tag, "SSAX", Ssax(), true); Test(tag, "UQSUB8", Uqsub8(), true); Test(tag, "USAD8", Usad8(), true); + Test(tag, "USADA8", Usada8(), true); Test(tag, "UXTAB16", Uxtab16(), true); Test(tag, "UXTB16", Uxtb16(), true); }