integer: Add CPU test for USAD8

This commit is contained in:
Lioncash 2014-12-14 20:11:59 -05:00
parent f4ed994057
commit 442c961038

View File

@ -127,6 +127,25 @@ static bool Uqsub8() {
return true;
}
// USAD8
static bool Usad8() {
unsigned int output;
unsigned int rm = 50;
unsigned int rn = 10;
// Regular subtraction
asm volatile ("USAD8 %[out], %[Rm], %[Rn]" : [out] "=r"(output) : [Rm] "r"(rm), [Rn] "r"(rn));
SoftAssert(output == 40);
// Absolute value subtraction (0 - 1) == 1 with USAD8. UCHAR_MAX rollover does not occur.
rm = 0;
rn = 1;
asm volatile ("USAD8 %[out], %[Rm], %[Rn]" : [out] "=r"(output) : [Rm] "r"(rm), [Rn] "r"(rn));
SoftAssert(output == 1);
return true;
}
// UXTAB16
static bool Uxtab16() {
unsigned int output;
@ -188,6 +207,7 @@ void TestAll() {
Test(tag, "SASX", Sasx(), true);
Test(tag, "SSAX", Ssax(), true);
Test(tag, "UQSUB8", Uqsub8(), true);
Test(tag, "USAD8", Usad8(), true);
Test(tag, "UXTAB16", Uxtab16(), true);
Test(tag, "UXTB16", Uxtb16(), true);
}