2018-09-08 18:23:07 +01:00
|
|
|
#define Bfm
|
2018-04-18 21:22:45 +01:00
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace Ryujinx.Tests.Cpu
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
[Category("Bfm")]
|
2018-04-18 21:22:45 +01:00
|
|
|
public sealed class CpuTestBfm : CpuTest
|
|
|
|
{
|
|
|
|
#if Bfm
|
2018-09-08 18:23:07 +01:00
|
|
|
private const int RndCnt = 2;
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("BFM <Xd>, <Xn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Bfm_64bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
|
|
|
[Random(RndCnt)] ulong xd,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] ulong xn,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint immr,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xB3400000; // BFM X0, X0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-09-08 18:23:07 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x0: xd, x1: xn, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("BFM <Wd>, <Wn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Bfm_32bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
|
|
|
[Random(RndCnt)] uint wd,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] uint wn,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint immr,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x33000000; // BFM W0, W0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-09-08 18:23:07 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x0: wd, x1: wn, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("SBFM <Xd>, <Xn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Sbfm_64bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] ulong xn,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint immr,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x93400000; // SBFM X0, X0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: xn, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("SBFM <Wd>, <Wn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Sbfm_32bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] uint wn,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint immr,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x13000000; // SBFM W0, W0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: wn, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("UBFM <Xd>, <Xn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ubfm_64bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] ulong xn,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint immr,
|
|
|
|
[Values(0u, 31u, 32u, 63u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xD3400000; // UBFM X0, X0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: xn, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("UBFM <Wd>, <Wn>, #<immr>, #<imms>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ubfm_32bit([Values(0u, 31u)] uint rd,
|
|
|
|
[Values(1u, 31u)] uint rn,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2023-02-09 01:24:32 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] uint wn,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint immr,
|
|
|
|
[Values(0u, 15u, 16u, 31u)] uint imms)
|
2018-04-18 21:22:45 +01:00
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x53000000; // UBFM W0, W0, #0, #0
|
|
|
|
opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
|
|
|
|
opcode |= ((immr & 63) << 16) | ((imms & 63) << 10);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: wn, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2023-02-09 01:24:32 +00:00
|
|
|
}
|