mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-07 22:38:37 +00:00
Add Frintz_S/V opcode and unit test, correction of some unit tests (#523)
* Add Frintz_S/V opcode and unit test, correction of some unit tests * --test * fix code style issue * delete tab
This commit is contained in:
parent
2e143365eb
commit
6aaf9ccb53
|
@ -1380,6 +1380,22 @@ namespace ChocolArm64.Instructions
|
|||
});
|
||||
}
|
||||
|
||||
public static void Frintz_S(ILEmitterCtx context)
|
||||
{
|
||||
EmitScalarUnaryOpF(context, () =>
|
||||
{
|
||||
EmitUnaryMathCall(context, nameof(Math.Truncate));
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frintz_V(ILEmitterCtx context)
|
||||
{
|
||||
EmitVectorUnaryOpF(context, () =>
|
||||
{
|
||||
EmitUnaryMathCall(context, nameof(Math.Truncate));
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frsqrte_S(ILEmitterCtx context)
|
||||
{
|
||||
EmitScalarUnaryOpF(context, () =>
|
||||
|
|
|
@ -329,6 +329,8 @@ namespace ChocolArm64
|
|||
SetA64("0>0011101<100001100010xxxxxxxxxx", InstEmit.Frintp_V, typeof(OpCodeSimd64));
|
||||
SetA64("000111100x100111010000xxxxxxxxxx", InstEmit.Frintx_S, typeof(OpCodeSimd64));
|
||||
SetA64("0>1011100<100001100110xxxxxxxxxx", InstEmit.Frintx_V, typeof(OpCodeSimd64));
|
||||
SetA64("000111100x100101110000xxxxxxxxxx", InstEmit.Frintz_S, typeof(OpCodeSimd64));
|
||||
SetA64("0>0011101<100001100110xxxxxxxxxx", InstEmit.Frintz_V, typeof(OpCodeSimd64));
|
||||
SetA64("011111101x100001110110xxxxxxxxxx", InstEmit.Frsqrte_S, typeof(OpCodeSimd64));
|
||||
SetA64("0>1011101<100001110110xxxxxxxxxx", InstEmit.Frsqrte_V, typeof(OpCodeSimd64));
|
||||
SetA64("010111101x1xxxxx111111xxxxxxxxxx", InstEmit.Frsqrts_S, typeof(OpCodeSimdReg64));
|
||||
|
|
|
@ -35,36 +35,12 @@ namespace Ryujinx.Tests.Cpu
|
|||
[TestCase(0x3FC00000u, false, 0x40000000u)]
|
||||
[TestCase(0x40200000u, false, 0x40400000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frinta_S(uint a, bool defaultNaN, uint result)
|
||||
{
|
||||
|
@ -73,6 +49,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -85,15 +62,14 @@ namespace Ryujinx.Tests.Cpu
|
|||
CompareAgainstUnicorn();
|
||||
}
|
||||
|
||||
[Ignore("Wrong opcodes.")]
|
||||
[TestCase(0x6E618820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)] // FRINTA V0.2D, V1.2D
|
||||
[TestCase(0x6E618820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E618820u, 0x3FF8000000000000ul, 0x3FF8000000000000ul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3F99999A3FE66666ul, 0x3F99999A3FE66666ul, false, 0x3F80000040000000ul, 0x3F80000040000000ul)] // FRINTX V0.4S, V1.4S
|
||||
[TestCase(0x6E219820u, 0x3FC000003FC00000ul, 0x3FC000003FC00000ul, false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0x2E219820u, 0x3F99999A3FE66666ul, 0x3F99999A3FE66666ul, false, 0x3F80000040000000ul, 0x0000000000000000ul)] // FRINTX V0.2S, V1.2S
|
||||
[TestCase(0x2E219820u, 0x3FC000003FC00000ul, 0x3FC000003FC00000ul, false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E218820u, 0x0000000080000000ul, 0x0000000000000000ul, false, 0x0000000080000000ul, 0x0000000000000000ul)] // FRINTA V0.2S, V1.2S
|
||||
[TestCase(0x6E218820u, 0x3F99999A3FE66666ul, 0x3F99999A3FE66666ul, false, 0x3F80000040000000ul, 0x3F80000040000000ul)] // FRINTA V0.4S, V1.4S
|
||||
[TestCase(0x6E218820u, 0x3FC000003FC00000ul, 0x3FC000003FC00000ul, false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0x2E218820u, 0x3F99999A3FE66666ul, 0x3F99999A3FE66666ul, false, 0x3F80000040000000ul, 0x0000000000000000ul)] // FRINTA V0.2S, V1.2S
|
||||
[TestCase(0x2E218820u, 0x3FC000003FC00000ul, 0x3FC000003FC00000ul, false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E218820u, 0x0000000080000000ul, 0x0000000000000000ul, false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E218820u, 0x7F800000FF800000ul, 0x0000000000000000ul, false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E218820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E218820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
|
@ -102,6 +78,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -165,13 +142,15 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
switch(roundMode)
|
||||
|
||||
switch (roundMode)
|
||||
{
|
||||
case 'N': fpcrTemp = 0x0; break;
|
||||
case 'P': fpcrTemp = 0x400000; break;
|
||||
case 'M': fpcrTemp = 0x800000; break;
|
||||
case 'Z': fpcrTemp = 0xC00000; break;
|
||||
}
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp |= 1 << 25;
|
||||
|
@ -221,13 +200,15 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
switch(roundMode)
|
||||
|
||||
switch (roundMode)
|
||||
{
|
||||
case 'N': fpcrTemp = 0x0; break;
|
||||
case 'P': fpcrTemp = 0x400000; break;
|
||||
case 'M': fpcrTemp = 0x800000; break;
|
||||
case 'Z': fpcrTemp = 0xC00000; break;
|
||||
}
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp |= 1 << 25;
|
||||
|
@ -251,36 +232,12 @@ namespace Ryujinx.Tests.Cpu
|
|||
[TestCase(0x3FC00000u, false, 0x3F800000u)]
|
||||
[TestCase(0x40200000u, false, 0x40000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frintm_S(uint a, bool defaultNaN, uint result)
|
||||
{
|
||||
|
@ -289,6 +246,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -314,6 +272,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -330,52 +289,28 @@ namespace Ryujinx.Tests.Cpu
|
|||
CompareAgainstUnicorn();
|
||||
}
|
||||
|
||||
[Ignore("Wrong opcode.")]
|
||||
[TestCase(0x3FE66666u, false, 0x40000000u)]
|
||||
[TestCase(0x3F99999Au, false, 0x3F800000u)]
|
||||
[TestCase(0x404CCCCDu, false, 0x40400000u)]
|
||||
[TestCase(0x40733333u, false, 0x40800000u)]
|
||||
[TestCase(0x3FC00000u, false, 0x40000000u)]
|
||||
[TestCase(0x40200000u, false, 0x40400000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x40200000u, false, 0x40000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frintn_S(uint a, bool defaultNaN, uint result)
|
||||
{
|
||||
uint opcode = 0x1E264020; // FRINTA S0, S1
|
||||
uint opcode = 0x1E244020; // FRINTN S0, S1
|
||||
|
||||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -404,6 +339,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -427,36 +363,12 @@ namespace Ryujinx.Tests.Cpu
|
|||
[TestCase(0x3FC00000u, false, 0x40000000u)]
|
||||
[TestCase(0x40200000u, false, 0x40400000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, false, 0x00000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, false, 0x80000000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, false, 0x7F800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frintp_S(uint a, bool defaultNaN, uint result)
|
||||
{
|
||||
|
@ -465,6 +377,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -490,6 +403,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
|
@ -553,13 +467,15 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
switch(roundMode)
|
||||
|
||||
switch (roundMode)
|
||||
{
|
||||
case 'N': fpcrTemp = 0x0; break;
|
||||
case 'P': fpcrTemp = 0x400000; break;
|
||||
case 'M': fpcrTemp = 0x800000; break;
|
||||
case 'Z': fpcrTemp = 0xC00000; break;
|
||||
}
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp |= 1 << 25;
|
||||
|
@ -609,13 +525,15 @@ namespace Ryujinx.Tests.Cpu
|
|||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
switch(roundMode)
|
||||
|
||||
switch (roundMode)
|
||||
{
|
||||
case 'N': fpcrTemp = 0x0; break;
|
||||
case 'P': fpcrTemp = 0x400000; break;
|
||||
case 'M': fpcrTemp = 0x800000; break;
|
||||
case 'Z': fpcrTemp = 0xC00000; break;
|
||||
}
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp |= 1 << 25;
|
||||
|
@ -632,6 +550,58 @@ namespace Ryujinx.Tests.Cpu
|
|||
CompareAgainstUnicorn();
|
||||
}
|
||||
|
||||
[TestCase(0xBFF33333u, false, 0xBF800000u)]
|
||||
[TestCase(0x40200000u, false, 0x40000000u)]
|
||||
[TestCase(0xFF800001u, false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frintz_S(uint a, bool defaultNaN, uint result)
|
||||
{
|
||||
uint opcode = 0x1E25C020; // FRINTZ S0, S1
|
||||
|
||||
Vector128<float> v1 = MakeVectorE0(a);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
}
|
||||
|
||||
CpuThreadState threadState = SingleOpcode(opcode, v1: v1, fpcr: fpcrTemp);
|
||||
|
||||
Assert.That(GetVectorE0(threadState.V0), Is.EqualTo(result));
|
||||
|
||||
CompareAgainstUnicorn();
|
||||
}
|
||||
|
||||
[TestCase(0x4EE19820u, 0xBFF999999999999Aul, 0xBFF999999999999Aul, false, 0xBFF0000000000000ul, 0xBFF0000000000000ul)] // FRINTZ V0.2D, V1.2D
|
||||
[TestCase(0x4EE19820u, 0x4004000000000000ul, 0x4004000000000000ul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x0EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x0EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frintz_V(uint opcode, ulong a, ulong b, bool defaultNaN, ulong result0, ulong result1)
|
||||
{
|
||||
Vector128<float> v1 = MakeVectorE0E1(a, b);
|
||||
|
||||
int fpcrTemp = 0x0;
|
||||
|
||||
if (defaultNaN)
|
||||
{
|
||||
fpcrTemp = 0x2000000;
|
||||
}
|
||||
|
||||
CpuThreadState threadState = SingleOpcode(opcode, v1: v1, fpcr: fpcrTemp);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(GetVectorE0(threadState.V0), Is.EqualTo(result0));
|
||||
Assert.That(GetVectorE1(threadState.V0), Is.EqualTo(result1));
|
||||
});
|
||||
|
||||
CompareAgainstUnicorn();
|
||||
}
|
||||
|
||||
[TestCase(0x41200000u, 0x3EA18000u)]
|
||||
public void Frsqrte_S(uint a, uint result)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue