| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693 |
- #define SimdIns
- using ARMeilleure.State;
- using NUnit.Framework;
- namespace Ryujinx.Tests.Cpu
- {
- [Category("SimdIns")]
- public sealed class CpuTestSimdIns : CpuTest
- {
- #if SimdIns
- #region "ValueSource"
- private static ulong[] _1D_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
- 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static ulong[] _2S_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7FFFFFFF7FFFFFFFul,
- 0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static ulong[] _4H_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7FFF7FFF7FFF7FFFul,
- 0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static ulong[] _8B_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
- 0x8080808080808080ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static ulong[] _8B4H_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
- 0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
- 0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static ulong[] _8B4H2S_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
- 0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
- 0x8000800080008000ul, 0x7FFFFFFF7FFFFFFFul,
- 0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- private static uint[] _W_()
- {
- return new uint[] { 0x00000000u, 0x0000007Fu,
- 0x00000080u, 0x000000FFu,
- 0x00007FFFu, 0x00008000u,
- 0x0000FFFFu, 0x7FFFFFFFu,
- 0x80000000u, 0xFFFFFFFFu };
- }
- private static ulong[] _X_()
- {
- return new ulong[] { 0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
- 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
- }
- #endregion
- private const int RndCnt = 2;
- private const int RndCntIndex = 2;
- [Test, Pairwise, Description("DUP <Vd>.<T>, W<n>")]
- public void Dup_Gp_W([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_W_")] [Random(RndCnt)] uint wn,
- [Values(0, 1, 2)] int size, // Q0: <8B, 4H, 2S>
- [Values(0b0u, 0b1u)] uint q) // Q1: <16B, 8H, 4S>
- {
- uint imm5 = (1u << size) & 0x1Fu;
- uint opcode = 0x0E000C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= ((q & 1) << 30);
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP <Vd>.<T>, X<n>")]
- public void Dup_Gp_X([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_X_")] [Random(RndCnt)] ulong xn)
- {
- uint opcode = 0x4E080C00; // DUP V0.2D, X0
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: xn, x31: x31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP B0, V1.B[<index>]")]
- public void Dup_S_B([ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index)
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x5E000420; // RESERVED
- opcode |= (imm5 << 16);
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP H0, V1.H[<index>]")]
- public void Dup_S_H([ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index)
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x5E000420; // RESERVED
- opcode |= (imm5 << 16);
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP S0, V1.S[<index>]")]
- public void Dup_S_S([ValueSource("_2S_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u, 2u, 3u)] uint index)
- {
- const int size = 2;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x5E000420; // RESERVED
- opcode |= (imm5 << 16);
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP D0, V1.D[<index>]")]
- public void Dup_S_D([ValueSource("_1D_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u)] uint index)
- {
- const int size = 3;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x5E000420; // RESERVED
- opcode |= (imm5 << 16);
- ulong z = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.B[<index>]")]
- public void Dup_V_8B_16B([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong z,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index,
- [Values(0b0u, 0b1u)] uint q) // <8B, 16B>
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= ((q & 1) << 30);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.H[<index>]")]
- public void Dup_V_4H_8H([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong z,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index,
- [Values(0b0u, 0b1u)] uint q) // <4H, 8H>
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= ((q & 1) << 30);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.S[<index>]")]
- public void Dup_V_2S_4S([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong z,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u, 2u, 3u)] uint index,
- [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
- {
- const int size = 2;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= ((q & 1) << 30);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.D[<index>]")]
- public void Dup_V_2D([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong z,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u)] uint index,
- [Values(0b1u)] uint q) // <2D>
- {
- const int size = 3;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= ((q & 1) << 30);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.B[<index>], W<n>")]
- public void Ins_Gp_WB([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong z,
- [ValueSource("_W_")] [Random(RndCnt)] uint wn,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index)
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E001C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.H[<index>], W<n>")]
- public void Ins_Gp_WH([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong z,
- [ValueSource("_W_")] [Random(RndCnt)] uint wn,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index)
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E001C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.S[<index>], W<n>")]
- public void Ins_Gp_WS([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong z,
- [ValueSource("_W_")] [Random(RndCnt)] uint wn,
- [Values(0u, 1u, 2u, 3u)] uint index)
- {
- const int size = 2;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E001C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.D[<index>], X<n>")]
- public void Ins_Gp_XD([Values(0u)] uint rd,
- [Values(1u, 31u)] uint rn,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong z,
- [ValueSource("_X_")] [Random(RndCnt)] ulong xn,
- [Values(0u, 1u)] uint index)
- {
- const int size = 3;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E001C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- V128 v0 = MakeVectorE0E1(z, z);
- SingleOpcode(opcode, x1: xn, x31: x31, v0: v0);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.B[<index1>], <Vn>.B[<index2>]")]
- public void Ins_V_BB([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong z,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint dstIndex,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint srcIndex)
- {
- const int size = 0;
- uint imm5 = (dstIndex << (size + 1) | 1u << size) & 0x1Fu;
- uint imm4 = (srcIndex << size) & 0xFu;
- uint opcode = 0x6E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= (imm4 << 11);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.H[<index1>], <Vn>.H[<index2>]")]
- public void Ins_V_HH([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong z,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint dstIndex,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint srcIndex)
- {
- const int size = 1;
- uint imm5 = (dstIndex << (size + 1) | 1u << size) & 0x1Fu;
- uint imm4 = (srcIndex << size) & 0xFu;
- uint opcode = 0x6E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= (imm4 << 11);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.S[<index1>], <Vn>.S[<index2>]")]
- public void Ins_V_SS([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong z,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u, 2u, 3u)] uint dstIndex,
- [Values(0u, 1u, 2u, 3u)] uint srcIndex)
- {
- const int size = 2;
- uint imm5 = (dstIndex << (size + 1) | 1u << size) & 0x1Fu;
- uint imm4 = (srcIndex << size) & 0xFu;
- uint opcode = 0x6E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= (imm4 << 11);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("INS <Vd>.D[<index1>], <Vn>.D[<index2>]")]
- public void Ins_V_DD([Values(0u)] uint rd,
- [Values(1u, 0u)] uint rn,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong z,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u)] uint dstIndex,
- [Values(0u, 1u)] uint srcIndex)
- {
- const int size = 3;
- uint imm5 = (dstIndex << (size + 1) | 1u << size) & 0x1Fu;
- uint imm4 = (srcIndex << size) & 0xFu;
- uint opcode = 0x6E000400; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- opcode |= (imm4 << 11);
- V128 v0 = MakeVectorE0E1(z, z);
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, v0: v0, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("SMOV <Wd>, <Vn>.B[<index>]")]
- public void Smov_S_BW([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index)
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E002C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("SMOV <Wd>, <Vn>.H[<index>]")]
- public void Smov_S_HW([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index)
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E002C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("SMOV <Xd>, <Vn>.B[<index>]")]
- public void Smov_S_BX([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index)
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E002C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x31: x31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("SMOV <Xd>, <Vn>.H[<index>]")]
- public void Smov_S_HX([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index)
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E002C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x31: x31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("SMOV <Xd>, <Vn>.S[<index>]")]
- public void Smov_S_SX([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u, 2u, 3u)] uint index)
- {
- const int size = 2;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E002C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x31: x31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("UMOV <Wd>, <Vn>.B[<index>]")]
- public void Umov_S_BW([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
- [Values(0u, 15u)] [Random(1u, 14u, RndCntIndex)] uint index)
- {
- const int size = 0;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E003C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("UMOV <Wd>, <Vn>.H[<index>]")]
- public void Umov_S_HW([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
- [Values(0u, 7u)] [Random(1u, 6u, RndCntIndex)] uint index)
- {
- const int size = 1;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E003C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("UMOV <Wd>, <Vn>.S[<index>]")]
- public void Umov_S_SW([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_2S_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u, 2u, 3u)] uint index)
- {
- const int size = 2;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x0E003C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
- uint w31 = TestContext.CurrentContext.Random.NextUInt();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
- CompareAgainstUnicorn();
- }
- [Test, Pairwise, Description("UMOV <Xd>, <Vn>.D[<index>]")]
- public void Umov_S_DX([Values(0u, 31u)] uint rd,
- [Values(1u)] uint rn,
- [ValueSource("_1D_")] [Random(RndCnt)] ulong a,
- [Values(0u, 1u)] uint index)
- {
- const int size = 3;
- uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
- uint opcode = 0x4E003C00; // RESERVED
- opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
- opcode |= (imm5 << 16);
- ulong x31 = TestContext.CurrentContext.Random.NextULong();
- V128 v1 = MakeVectorE0E1(a, a);
- SingleOpcode(opcode, x31: x31, v1: v1);
- CompareAgainstUnicorn();
- }
- #endif
- }
- }
|