Add Sadalp_V, Saddlp_V, Uadalp_V, Uaddlp_V instructions; add 8 Tests. (#340)

* Update Instructions.cs

* Update CpuTestSimd.cs

* Update AOpCodeTable.cs

* Update AInstEmitSimdArithmetic.cs
This commit is contained in:
LDj3SNuD 2018-08-13 23:10:02 +02:00 committed by gdkchan
parent c05600a26b
commit 4518c52c65
4 changed files with 443 additions and 0 deletions

View file

@ -3060,6 +3060,90 @@ namespace Ryujinx.Tests.Cpu.Tester
V(d, result);
}
// sadalp_advsimd.html
public static void Sadalp_V(bool Q, Bits size, Bits Rn, Bits Rd)
{
const bool U = false;
const bool op = true;
/* Decode Vector */
int d = (int)UInt(Rd);
int n = (int)UInt(Rn);
/* if size == '11' then ReservedValue(); */
int esize = 8 << (int)UInt(size);
int datasize = (Q ? 128 : 64);
int elements = datasize / (2 * esize);
bool acc = (op == true);
bool unsigned = (U == true);
/* Operation */
/* CheckFPAdvSIMDEnabled64(); */
Bits operand = V(datasize, n);
Bits sum;
BigInteger op1;
BigInteger op2;
Bits result = (acc ? V(datasize, d) : Zeros(datasize));
for (int e = 0; e <= elements - 1; e++)
{
op1 = Int(Elem(operand, 2 * e + 0, esize), unsigned);
op2 = Int(Elem(operand, 2 * e + 1, esize), unsigned);
sum = (op1 + op2).SubBigInteger(2 * esize - 1, 0);
Elem(result, e, 2 * esize, Elem(result, e, 2 * esize) + sum);
}
V(d, result);
}
// saddlp_advsimd.html
public static void Saddlp_V(bool Q, Bits size, Bits Rn, Bits Rd)
{
const bool U = false;
const bool op = false;
/* Decode Vector */
int d = (int)UInt(Rd);
int n = (int)UInt(Rn);
/* if size == '11' then ReservedValue(); */
int esize = 8 << (int)UInt(size);
int datasize = (Q ? 128 : 64);
int elements = datasize / (2 * esize);
bool acc = (op == true);
bool unsigned = (U == true);
/* Operation */
/* CheckFPAdvSIMDEnabled64(); */
Bits operand = V(datasize, n);
Bits sum;
BigInteger op1;
BigInteger op2;
Bits result = (acc ? V(datasize, d) : Zeros(datasize));
for (int e = 0; e <= elements - 1; e++)
{
op1 = Int(Elem(operand, 2 * e + 0, esize), unsigned);
op2 = Int(Elem(operand, 2 * e + 1, esize), unsigned);
sum = (op1 + op2).SubBigInteger(2 * esize - 1, 0);
Elem(result, e, 2 * esize, Elem(result, e, 2 * esize) + sum);
}
V(d, result);
}
// sqabs_advsimd.html#SQABS_asisdmisc_R
public static void Sqabs_S(Bits size, Bits Rn, Bits Rd)
{
@ -3522,6 +3606,90 @@ namespace Ryujinx.Tests.Cpu.Tester
V(d, result);
}
// uadalp_advsimd.html
public static void Uadalp_V(bool Q, Bits size, Bits Rn, Bits Rd)
{
const bool U = true;
const bool op = true;
/* Decode Vector */
int d = (int)UInt(Rd);
int n = (int)UInt(Rn);
/* if size == '11' then ReservedValue(); */
int esize = 8 << (int)UInt(size);
int datasize = (Q ? 128 : 64);
int elements = datasize / (2 * esize);
bool acc = (op == true);
bool unsigned = (U == true);
/* Operation */
/* CheckFPAdvSIMDEnabled64(); */
Bits operand = V(datasize, n);
Bits sum;
BigInteger op1;
BigInteger op2;
Bits result = (acc ? V(datasize, d) : Zeros(datasize));
for (int e = 0; e <= elements - 1; e++)
{
op1 = Int(Elem(operand, 2 * e + 0, esize), unsigned);
op2 = Int(Elem(operand, 2 * e + 1, esize), unsigned);
sum = (op1 + op2).SubBigInteger(2 * esize - 1, 0);
Elem(result, e, 2 * esize, Elem(result, e, 2 * esize) + sum);
}
V(d, result);
}
// uaddlp_advsimd.html
public static void Uaddlp_V(bool Q, Bits size, Bits Rn, Bits Rd)
{
const bool U = true;
const bool op = false;
/* Decode Vector */
int d = (int)UInt(Rd);
int n = (int)UInt(Rn);
/* if size == '11' then ReservedValue(); */
int esize = 8 << (int)UInt(size);
int datasize = (Q ? 128 : 64);
int elements = datasize / (2 * esize);
bool acc = (op == true);
bool unsigned = (U == true);
/* Operation */
/* CheckFPAdvSIMDEnabled64(); */
Bits operand = V(datasize, n);
Bits sum;
BigInteger op1;
BigInteger op2;
Bits result = (acc ? V(datasize, d) : Zeros(datasize));
for (int e = 0; e <= elements - 1; e++)
{
op1 = Int(Elem(operand, 2 * e + 0, esize), unsigned);
op2 = Int(Elem(operand, 2 * e + 1, esize), unsigned);
sum = (op1 + op2).SubBigInteger(2 * esize - 1, 0);
Elem(result, e, 2 * esize, Elem(result, e, 2 * esize) + sum);
}
V(d, result);
}
// uqxtn_advsimd.html#UQXTN_asisdmisc_N
public static void Uqxtn_S(Bits size, Bits Rn, Bits Rd)
{