Add Frint Instructions and Tests (#62)
* add 'ADC 32bit and Overflow' test * Add WZR/WSP tests * fix ADC and ADDS * add ADCS test * add SBCS test * indent my code and delete comment * '/' <- i hate you x) * remove spacebar char * remove false tab * add frintx_S test * update frintx_S test * add ASRV test * fix new line * fix PR * fix indent * Add add_V tests * work on Frintx_V * Add Frintx_V Instruction * add some instruction and test * Syntax + indent * Delete Console Write * Delete Console Write 2 * CR del * Skip NaNs tests * Skip NaNs tests 2 * Fix errors 1 * Fix errors 2
This commit is contained in:
parent
3c82c8de8c
commit
ca6cf1cc90
4 changed files with 680 additions and 19 deletions
|
@ -208,10 +208,17 @@ namespace ChocolArm64
|
|||
Set("000111110x1xxxxx1xxxxxxxxxxxxxxx", AInstEmit.Fnmsub_S, typeof(AOpCodeSimdReg));
|
||||
Set("000111100x1xxxxx100010xxxxxxxxxx", AInstEmit.Fnmul_S, typeof(AOpCodeSimdReg));
|
||||
Set("000111100x100110010000xxxxxxxxxx", AInstEmit.Frinta_S, typeof(AOpCodeSimd));
|
||||
Set("0>1011100<100001100010xxxxxxxxxx", AInstEmit.Frinta_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100111110000xxxxxxxxxx", AInstEmit.Frinti_S, typeof(AOpCodeSimd));
|
||||
Set("0>1011101<100001100110xxxxxxxxxx", AInstEmit.Frinti_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100101010000xxxxxxxxxx", AInstEmit.Frintm_S, typeof(AOpCodeSimd));
|
||||
Set("0>0011100<100001100110xxxxxxxxxx", AInstEmit.Frintm_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100100010000xxxxxxxxxx", AInstEmit.Frintn_S, typeof(AOpCodeSimd));
|
||||
Set("0>0011100<100001100010xxxxxxxxxx", AInstEmit.Frintn_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100100110000xxxxxxxxxx", AInstEmit.Frintp_S, typeof(AOpCodeSimd));
|
||||
Set("0>0011101<100001100010xxxxxxxxxx", AInstEmit.Frintp_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100111010000xxxxxxxxxx", AInstEmit.Frintx_S, typeof(AOpCodeSimd));
|
||||
Set("0>1011100<100001100110xxxxxxxxxx", AInstEmit.Frintx_V, typeof(AOpCodeSimd));
|
||||
Set("000111100x100001110000xxxxxxxxxx", AInstEmit.Fsqrt_S, typeof(AOpCodeSimd));
|
||||
Set("000111100x1xxxxx001110xxxxxxxxxx", AInstEmit.Fsub_S, typeof(AOpCodeSimdReg));
|
||||
Set("0>0011101<1xxxxx110101xxxxxxxxxx", AInstEmit.Fsub_V, typeof(AOpCodeSimdReg));
|
||||
|
|
|
@ -248,6 +248,56 @@ namespace ChocolArm64.Instruction
|
|||
EmitScalarSetF(Context, Op.Rd, SizeF);
|
||||
}
|
||||
|
||||
public static void Frinti_S(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
||||
EmitScalarUnaryOpF(Context, () =>
|
||||
{
|
||||
Context.EmitLdarg(ATranslatedSub.StateArgIdx);
|
||||
|
||||
Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr));
|
||||
|
||||
if (Op.Size == 0)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF));
|
||||
}
|
||||
else if (Op.Size == 1)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frinti_V(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
||||
EmitVectorUnaryOpF(Context, () =>
|
||||
{
|
||||
Context.EmitLdarg(ATranslatedSub.StateArgIdx);
|
||||
|
||||
Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr));
|
||||
|
||||
if (Op.Size == 2)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF));
|
||||
}
|
||||
else if (Op.Size == 3)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frinta_S(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
@ -259,6 +309,14 @@ namespace ChocolArm64.Instruction
|
|||
EmitScalarSetF(Context, Op.Rd, Op.Size);
|
||||
}
|
||||
|
||||
public static void Frinta_V(AILEmitterCtx Context)
|
||||
{
|
||||
EmitVectorUnaryOpF(Context, () =>
|
||||
{
|
||||
EmitRoundMathCall(Context, MidpointRounding.AwayFromZero);
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frintm_S(AILEmitterCtx Context)
|
||||
{
|
||||
EmitScalarUnaryOpF(Context, () =>
|
||||
|
@ -275,6 +333,25 @@ namespace ChocolArm64.Instruction
|
|||
});
|
||||
}
|
||||
|
||||
public static void Frintn_S(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
||||
EmitVectorExtractF(Context, Op.Rn, 0, Op.Size);
|
||||
|
||||
EmitRoundMathCall(Context, MidpointRounding.ToEven);
|
||||
|
||||
EmitScalarSetF(Context, Op.Rd, Op.Size);
|
||||
}
|
||||
|
||||
public static void Frintn_V(AILEmitterCtx Context)
|
||||
{
|
||||
EmitVectorUnaryOpF(Context, () =>
|
||||
{
|
||||
EmitRoundMathCall(Context, MidpointRounding.ToEven);
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frintp_S(AILEmitterCtx Context)
|
||||
{
|
||||
EmitScalarUnaryOpF(Context, () =>
|
||||
|
@ -283,6 +360,14 @@ namespace ChocolArm64.Instruction
|
|||
});
|
||||
}
|
||||
|
||||
public static void Frintp_V(AILEmitterCtx Context)
|
||||
{
|
||||
EmitVectorUnaryOpF(Context, () =>
|
||||
{
|
||||
EmitUnaryMathCall(Context, nameof(Math.Ceiling));
|
||||
});
|
||||
}
|
||||
|
||||
public static void Frintx_S(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
@ -308,6 +393,31 @@ namespace ChocolArm64.Instruction
|
|||
});
|
||||
}
|
||||
|
||||
public static void Frintx_V(AILEmitterCtx Context)
|
||||
{
|
||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||
|
||||
EmitVectorUnaryOpF(Context, () =>
|
||||
{
|
||||
Context.EmitLdarg(ATranslatedSub.StateArgIdx);
|
||||
|
||||
Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr));
|
||||
|
||||
if (Op.Size == 0)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF));
|
||||
}
|
||||
else if (Op.Size == 1)
|
||||
{
|
||||
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void Fsqrt_S(AILEmitterCtx Context)
|
||||
{
|
||||
EmitScalarUnaryOpF(Context, () =>
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace Ryujinx.Tests.Cpu
|
|||
[TestCase(0x7F7FFFFFu, 0x807FFFFFu, 0x7F7FFFFFu)]
|
||||
[TestCase(0x7FC00000u, 0x3F800000u, 0x7FC00000u)]
|
||||
[TestCase(0x3F800000u, 0x7FC00000u, 0x7FC00000u)]
|
||||
[TestCase(0x7F800001u, 0x7FC00042u, 0x7FC00001u)]
|
||||
[TestCase(0x7FC00042u, 0x7F800001u, 0x7FC00001u)]
|
||||
[TestCase(0x7FC0000Au, 0x7FC0000Bu, 0x7FC0000Au)]
|
||||
[TestCase(0x7F800001u, 0x7FC00042u, 0x7FC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00042u, 0x7F800001u, 0x7FC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC0000Au, 0x7FC0000Bu, 0x7FC0000Au, Ignore = "NaN test.")]
|
||||
public void Fmax_S(uint A, uint B, uint Result)
|
||||
{
|
||||
// FMAX S0, S1, S2
|
||||
|
|
|
@ -5,6 +5,123 @@ namespace Ryujinx.Tests.Cpu
|
|||
{
|
||||
public class CpuTestSimdArithmetic : CpuTest
|
||||
{
|
||||
[TestCase(0xE228420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE228420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x00000000FFFFFF00ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE228420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFEFEFEFEFEFEFEFEul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE228420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4E228420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4E228420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x00000000FFFFFF00ul, 0x00000000FFFFFF00ul)]
|
||||
[TestCase(0x4E228420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFEFEFEFEFEFEFEFEul, 0xFEFEFEFEFEFEFEFEul)]
|
||||
[TestCase(0x4E228420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0xCCCCCCCCCCCCCCCCul)]
|
||||
[TestCase(0xE628420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE628420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x00000000FFFF0000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE628420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFEFFFEFFFEFFFEul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE628420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4E628420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4E628420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x00000000FFFF0000ul, 0x00000000FFFF0000ul)]
|
||||
[TestCase(0x4E628420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFEFFFEFFFEFFFEul, 0xFFFEFFFEFFFEFFFEul)]
|
||||
[TestCase(0x4E628420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0xCCCCCCCCCCCCCCCCul)]
|
||||
[TestCase(0xEA28420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA28420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA28420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFEFFFFFFFEul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA28420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4EA28420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4EA28420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4EA28420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFEFFFFFFFEul, 0xFFFFFFFEFFFFFFFEul)]
|
||||
[TestCase(0x4EA28420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0xCCCCCCCCCCCCCCCCul)]
|
||||
[TestCase(0x4EE28420u, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x4EE28420u, 0x00000000FFFFFFFFul, 0x00000000FFFFFFFFul, 0x0000000000000001ul, 0x0000000000000001ul, 0x0000000100000000ul, 0x0000000100000000ul)]
|
||||
[TestCase(0x4EE28420u, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFFul, 0xFFFFFFFFFFFFFFFEul, 0xFFFFFFFFFFFFFFFEul)]
|
||||
[TestCase(0x4EE28420u, 0x0102030405060708ul, 0xAAAAAAAAAAAAAAAAul, 0x0807060504030201ul, 0x2222222222222222ul, 0x0909090909090909ul, 0xCCCCCCCCCCCCCCCCul)]
|
||||
public void Add_V(uint Opcode, ulong A0, ulong A1, ulong B0, ulong B1, ulong Result0, ulong Result1)
|
||||
{
|
||||
AVec V1 = new AVec { X0 = A0, X1 = A1 };
|
||||
AVec V2 = new AVec { X0 = B0, X1 = B1 };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, V2: V2);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[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(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)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A };
|
||||
AThreadState ThreadState = SingleOpcode(0x1E264020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x6E618820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E618820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E618820u, 0x3FF8000000000000ul, 0x3FF8000000000000ul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f80000040000000ul, 0x3f80000040000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3fc000003fc00000ul, 0x3fc000003fc00000ul, false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0x2E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f80000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 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.")]
|
||||
public void Frinta_V(uint Opcode, ulong A, ulong B, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(0x3FE66666u, 'N', false, 0x40000000u)]
|
||||
[TestCase(0x3F99999Au, 'N', false, 0x3F800000u)]
|
||||
[TestCase(0x404CCCCDu, 'P', false, 0x40800000u)]
|
||||
|
@ -29,22 +146,383 @@ namespace Ryujinx.Tests.Cpu
|
|||
[TestCase(0xFF800000u, 'P', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, 'M', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, 'Z', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, 'N', false, 0xFFC00001u)]
|
||||
[TestCase(0xFF800001u, 'P', false, 0xFFC00001u)]
|
||||
[TestCase(0xFF800001u, 'M', false, 0xFFC00001u)]
|
||||
[TestCase(0xFF800001u, 'Z', false, 0xFFC00001u)]
|
||||
[TestCase(0xFF800001u, 'N', true, 0x7FC00000u)]
|
||||
[TestCase(0xFF800001u, 'P', true, 0x7FC00000u)]
|
||||
[TestCase(0xFF800001u, 'M', true, 0x7FC00000u)]
|
||||
[TestCase(0xFF800001u, 'Z', true, 0x7FC00000u)]
|
||||
[TestCase(0x7FC00002u, 'N', false, 0x7FC00002u)]
|
||||
[TestCase(0x7FC00002u, 'P', false, 0x7FC00002u)]
|
||||
[TestCase(0x7FC00002u, 'M', false, 0x7FC00002u)]
|
||||
[TestCase(0x7FC00002u, 'Z', false, 0x7FC00002u)]
|
||||
[TestCase(0x7FC00002u, 'N', true, 0x7FC00000u)]
|
||||
[TestCase(0x7FC00002u, 'P', true, 0x7FC00000u)]
|
||||
[TestCase(0x7FC00002u, 'M', true, 0x7FC00000u)]
|
||||
[TestCase(0x7FC00002u, 'Z', true, 0x7FC00000u)]
|
||||
[TestCase(0xFF800001u, 'N', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'P', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'M', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'Z', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'N', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'P', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'M', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'Z', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'N', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'P', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'M', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'Z', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'N', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'P', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'M', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'Z', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frinti_S(uint A, char RoundType, bool DefaultNaN, uint Result)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
switch(RoundType)
|
||||
{
|
||||
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;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A };
|
||||
AThreadState ThreadState = SingleOpcode(0x1E27C020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x6EE19820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'N', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'N', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'P', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'P', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'M', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'M', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'Z', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6EE19820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'Z', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'N', false, 0x3f80000040000000ul, 0x3f80000040000000ul)]
|
||||
[TestCase(0x6EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'P', false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0x6EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'M', false, 0x3f8000003f800000ul, 0x3f8000003f800000ul)]
|
||||
[TestCase(0x6EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'Z', false, 0x3f8000003f800000ul, 0x3f8000003f800000ul)]
|
||||
[TestCase(0x2EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'N', false, 0x3f80000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'P', false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'M', false, 0x3f8000003f800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'Z', false, 0x3f8000003f800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x0000000080000000ul, 0x0000000000000000ul, 'N', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x0000000080000000ul, 0x0000000000000000ul, 'P', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x0000000080000000ul, 0x0000000000000000ul, 'M', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x0000000080000000ul, 0x0000000000000000ul, 'Z', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'N', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'P', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'M', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'Z', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'N', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'P', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'M', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'Z', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'N', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'P', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'M', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2EA19820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'Z', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frinti_V(uint Opcode, ulong A, ulong B, char RoundType, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
switch(RoundType)
|
||||
{
|
||||
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;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(0x3FE66666u, false, 0x3F800000u)]
|
||||
[TestCase(0x3F99999Au, false, 0x3F800000u)]
|
||||
[TestCase(0x404CCCCDu, false, 0x40400000u)]
|
||||
[TestCase(0x40733333u, false, 0x40400000u)]
|
||||
[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)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A };
|
||||
AThreadState ThreadState = SingleOpcode(0x1E254020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x4E619820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x4E619820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x4E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f8000003f800000ul, 0x3f8000003f800000ul)]
|
||||
[TestCase(0xE219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f8000003f800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE219820u, 0x0000000080000000ul, 0x0000000000000000ul, false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE219820u, 0x7F800000FF800000ul, 0x0000000000000000ul, false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0xE219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frintm_V(uint Opcode, ulong A, ulong B, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[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(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)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A };
|
||||
AThreadState ThreadState = SingleOpcode(0x1E264020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x4E618820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x4E618820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x4E618820u, 0x3FF8000000000000ul, 0x3FF8000000000000ul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x4E218820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f80000040000000ul, 0x3f80000040000000ul)]
|
||||
[TestCase(0x4E218820u, 0x3fc000003fc00000ul, 0x3fc000003fc00000ul, false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0xE218820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x3f80000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE218820u, 0x3fc000003fc00000ul, 0x3fc000003fc00000ul, false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE218820u, 0x0000000080000000ul, 0x0000000000000000ul, false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE218820u, 0x7F800000FF800000ul, 0x0000000000000000ul, false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xE218820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0xE218820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frintn_V(uint Opcode, ulong A, ulong B, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(0x3FE66666u, false, 0x40000000u)]
|
||||
[TestCase(0x3F99999Au, false, 0x40000000u)]
|
||||
[TestCase(0x404CCCCDu, false, 0x40800000u)]
|
||||
[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(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)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A };
|
||||
AThreadState ThreadState = SingleOpcode(0x1E24C020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x4EE18820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x4EE18820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x4EA18820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0xEA18820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA18820u, 0x0000000080000000ul, 0x0000000000000000ul, false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA18820u, 0x7F800000FF800000ul, 0x0000000000000000ul, false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0xEA18820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0xEA18820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frintp_V(uint Opcode, ulong A, ulong B, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
if(DefaultNaN)
|
||||
{
|
||||
FpcrTemp = 0x2000000;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(0x3FE66666u, 'N', false, 0x40000000u)]
|
||||
[TestCase(0x3F99999Au, 'N', false, 0x3F800000u)]
|
||||
[TestCase(0x404CCCCDu, 'P', false, 0x40800000u)]
|
||||
[TestCase(0x40733333u, 'P', false, 0x40800000u)]
|
||||
[TestCase(0x404CCCCDu, 'M', false, 0x40400000u)]
|
||||
[TestCase(0x40733333u, 'M', false, 0x40400000u)]
|
||||
[TestCase(0x3F99999Au, 'Z', false, 0x3F800000u)]
|
||||
[TestCase(0x3FE66666u, 'Z', false, 0x3F800000u)]
|
||||
[TestCase(0x00000000u, 'N', false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, 'P', false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, 'M', false, 0x00000000u)]
|
||||
[TestCase(0x00000000u, 'Z', false, 0x00000000u)]
|
||||
[TestCase(0x80000000u, 'N', false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, 'P', false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, 'M', false, 0x80000000u)]
|
||||
[TestCase(0x80000000u, 'Z', false, 0x80000000u)]
|
||||
[TestCase(0x7F800000u, 'N', false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, 'P', false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, 'M', false, 0x7F800000u)]
|
||||
[TestCase(0x7F800000u, 'Z', false, 0x7F800000u)]
|
||||
[TestCase(0xFF800000u, 'N', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, 'P', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, 'M', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800000u, 'Z', false, 0xFF800000u)]
|
||||
[TestCase(0xFF800001u, 'N', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'P', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'M', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'Z', false, 0xFFC00001u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'N', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'P', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'M', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0xFF800001u, 'Z', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'N', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'P', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'M', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'Z', false, 0x7FC00002u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'N', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'P', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'M', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
[TestCase(0x7FC00002u, 'Z', true, 0x7FC00000u, Ignore = "NaN test.")]
|
||||
public void Frintx_S(uint A, char RoundType, bool DefaultNaN, uint Result)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
|
@ -74,5 +552,71 @@ namespace Ryujinx.Tests.Cpu
|
|||
AThreadState ThreadState = SingleOpcode(0x1E274020, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.AreEqual(Result, ThreadState.V0.X0);
|
||||
}
|
||||
|
||||
[TestCase(0x6E619820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'N', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'N', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'P', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'P', false, 0x4000000000000000ul, 0x4000000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'M', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'M', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FF3333333333333ul, 0x3FF3333333333333ul, 'Z', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E619820u, 0x3FFCCCCCCCCCCCCDul, 0x3FFCCCCCCCCCCCCDul, 'Z', false, 0x3FF0000000000000ul, 0x3FF0000000000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'N', false, 0x3f80000040000000ul, 0x3f80000040000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'P', false, 0x4000000040000000ul, 0x4000000040000000ul)]
|
||||
[TestCase(0x6E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'M', false, 0x3f8000003f800000ul, 0x3f8000003f800000ul)]
|
||||
[TestCase(0x6E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'Z', false, 0x3f8000003f800000ul, 0x3f8000003f800000ul)]
|
||||
[TestCase(0x2E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'N', false, 0x3f80000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'P', false, 0x4000000040000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'M', false, 0x3f8000003f800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x3f99999a3fe66666ul, 0x3f99999a3fe66666ul, 'Z', false, 0x3f8000003f800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x0000000080000000ul, 0x0000000000000000ul, 'N', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x0000000080000000ul, 0x0000000000000000ul, 'P', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x0000000080000000ul, 0x0000000000000000ul, 'M', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x0000000080000000ul, 0x0000000000000000ul, 'Z', false, 0x0000000080000000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'N', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'P', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'M', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0x7F800000FF800000ul, 0x0000000000000000ul, 'Z', false, 0x7F800000FF800000ul, 0x0000000000000000ul)]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'N', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'P', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'M', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'Z', false, 0xFFC000017FC00002ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'N', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'P', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'M', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
[TestCase(0x2E219820u, 0xFF8000017FC00002ul, 0x0000000000000000ul, 'Z', true, 0x7FC000007FC00000ul, 0x0000000000000000ul, Ignore = "NaN test.")]
|
||||
public void Frintx_V(uint Opcode, ulong A, ulong B, char RoundType, bool DefaultNaN, ulong Result0, ulong Result1)
|
||||
{
|
||||
int FpcrTemp = 0x0;
|
||||
switch(RoundType)
|
||||
{
|
||||
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;
|
||||
}
|
||||
AVec V1 = new AVec { X0 = A, X1 = B };
|
||||
AThreadState ThreadState = SingleOpcode(Opcode, V1: V1, Fpcr: FpcrTemp);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.AreEqual(Result0, ThreadState.V0.X0);
|
||||
Assert.AreEqual(Result1, ThreadState.V0.X1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue