tests: Add test for udiv instruction.

This commit is contained in:
Józef Kucia 2017-07-21 14:14:42 +02:00
parent ea6b35ef58
commit 465f1c449e
1 changed files with 35 additions and 0 deletions

View File

@ -4806,6 +4806,30 @@ static void test_shader_instructions(void)
0x00000000, 0x00000000, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps_imul = {ps_imul_code, sizeof(ps_imul_code)};
static const DWORD ps_udiv_code[] =
{
#if 0
uint4 src0;
uint4 src1;
void main(out uint4 dst : SV_Target)
{
dst = 0;
dst.x = src0.x / src1.x;
dst.y = src0.x % src1.x;
}
#endif
0x43425844, 0x007d5f29, 0x042f2e56, 0x212eddf2, 0xc98cca76, 0x00000001, 0x00000120, 0x00000003,
0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x000000a8, 0x00000050, 0x0000002a,
0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
0x02000068, 0x00000002, 0x08000036, 0x001020c2, 0x00000000, 0x00004002, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x0b00004e, 0x00100012, 0x00000000, 0x00100012, 0x00000001, 0x0020800a,
0x00000000, 0x00000000, 0x0020800a, 0x00000000, 0x00000001, 0x05000036, 0x00102012, 0x00000000,
0x0010000a, 0x00000000, 0x05000036, 0x00102022, 0x00000000, 0x0010000a, 0x00000001, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps_udiv = {ps_udiv_code, sizeof(ps_udiv_code)};
static const DWORD ps_movc_code[] =
{
#if 0
@ -5306,6 +5330,17 @@ static void test_shader_instructions(void)
{&ps_imul, {{{2}, {~0u}}}, {{~1u}}},
{&ps_imul, {{{3}, {~0u}}}, {{~2u}}},
{&ps_udiv, {{{0}, {0}}}, {{~0u, ~0u}}},
{&ps_udiv, {{{1}, {0}}}, {{~0u, ~0u}}},
{&ps_udiv, {{{1}, {1}}}, {{ 1u, 0u}}},
{&ps_udiv, {{{7}, {1}}}, {{ 7u, 0u}}},
{&ps_udiv, {{{7}, {2}}}, {{ 3u, 1u}}},
{&ps_udiv, {{{7}, {3}}}, {{ 2u, 1u}}},
{&ps_udiv, {{{7}, {4}}}, {{ 1u, 3u}}},
{&ps_udiv, {{{7}, {5}}}, {{ 1u, 2u}}},
{&ps_udiv, {{{7}, {6}}}, {{ 1u, 1u}}},
{&ps_udiv, {{{7}, {7}}}, {{ 1u, 0u}}},
{&ps_movc, {{{0, 0, 0, 0}, {1, 2, 3, 4}, {5, 6, 7, 8}}}, {{5, 6, 7, 8}}},
{&ps_movc, {{{0, 0, 0, 1}, {1, 2, 3, 4}, {5, 6, 7, 8}}}, {{5, 6, 7, 4}}},
{&ps_movc, {{{1, 0, 0, 0}, {1, 2, 3, 4}, {5, 6, 7, 8}}}, {{1, 6, 7, 8}}},