From: Tom Stellard <thomas.stell...@amd.com> --- .../r300/compiler/tests/omod_two_writers.test | 5 +++ .../tests/radeon_compiler_optimize_tests.c | 49 +++++++--------------- .../tests/radeon_compiler_regalloc_tests.c | 13 +----- .../compiler/tests/regalloc_tex_1d_swizzle.test | 1 + 4 files changed, 21 insertions(+), 47 deletions(-)
diff --git a/src/gallium/drivers/r300/compiler/tests/omod_two_writers.test b/src/gallium/drivers/r300/compiler/tests/omod_two_writers.test index fb16bb0..854b53a 100644 --- a/src/gallium/drivers/r300/compiler/tests/omod_two_writers.test +++ b/src/gallium/drivers/r300/compiler/tests/omod_two_writers.test @@ -1,5 +1,10 @@ +const[0] = { 2.0000 0.0000 0.0000 0.0000 } + RCP temp[0].x, const[1].x___; RCP temp[0].y, const[1]._y__; MUL temp[1].xy, const[0].xx__, temp[0].xy__; MOV output[0].xy, temp[1].xy; = +RCP temp\[[0-9]\]\.x \* 2, const\[1\]\.x___; +RCP temp\[[0-9]\]\.y \* 2, const\[1\]\._y__; +MOV output\[0\]\.xy, temp\[[0-9]\]\.xy__; diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c index 3244d93..451e30a 100644 --- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c +++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_optimize_tests.c @@ -30,58 +30,37 @@ #include "rc_test_helpers.h" #include "unit_test.h" -static unsigned test_rc_optimize( +static void test_rc_optimize( struct test_result * result, - struct radeon_compiler * c, const char * filename) { + struct radeon_compiler c; struct rc_test_file test_file; + unsigned pass = 1; + init_compiler(&c, RC_FRAGMENT_PROGRAM, 1, 0); test_begin(result); - if (!load_program(c, &test_file, filename)) { + if (load_program(&c, &test_file, filename)) { + rc_optimize(&c, NULL); + pass = check_program(&c, &test_file); + } else { fprintf(stderr, "Failed to load program\n"); - return 0; - } + pass = 0; - rc_optimize(c, NULL); - return 1; + } + test_check(result, pass); } -static void test_runner_rc_optimize(struct test_result * result) +static void test_peephole_mul_omod(struct test_result * result) { - unsigned pass = 1; - struct radeon_compiler c; - struct rc_instruction *inst; - struct rc_instruction *inst_list[3]; - unsigned inst_count = 0; - float const0[4] = {2.0f, 0.0f, 0.0f, 0.0f}; - - init_compiler(&c, RC_FRAGMENT_PROGRAM, 1, 0); - - rc_constants_add_immediate_vec4(&c.Program.Constants, const0); - - test_rc_optimize(result, &c, "omod_two_writers.test"); - - for(inst = c.Program.Instructions.Next; - inst != &c.Program.Instructions; - inst = inst->Next, inst_count++) { - inst_list[inst_count] = inst; - } - - if (inst_list[0]->U.I.Omod != RC_OMOD_MUL_2 || - inst_list[1]->U.I.Omod != RC_OMOD_MUL_2 || - inst_list[2]->U.I.Opcode != RC_OPCODE_MOV) { - pass = 0; - } - - test_check(result, pass); + test_rc_optimize(result, "omod_two_writers.test"); } unsigned radeon_compiler_optimize_run_tests() { static struct test tests[] = { - {"rc_optimize() => peephole_mul_omod()", test_runner_rc_optimize}, + {"rc_optimize() => peephole_mul_omod()", test_peephole_mul_omod}, {NULL, NULL} }; return run_tests(tests); diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c index 70ba748..af6335d 100644 --- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c +++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_regalloc_tests.c @@ -62,18 +62,7 @@ static void test_runner_rc_regalloc( rc_pair_remove_dead_sources(c, NULL); rc_pair_regalloc(c, &do_full_regalloc); - for(inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; - inst = inst->Next) { - if (inst->Type == RC_INSTRUCTION_NORMAL && - inst->U.I.Opcode != RC_OPCODE_BEGIN_TEX) { - if (GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 0) - != RC_SWIZZLE_X) { - pass = 0; - } - } - } - + pass = check_program(c, &test_file); test_check(result, pass); } diff --git a/src/gallium/drivers/r300/compiler/tests/regalloc_tex_1d_swizzle.test b/src/gallium/drivers/r300/compiler/tests/regalloc_tex_1d_swizzle.test index 8ecfcc1..1f75df2 100644 --- a/src/gallium/drivers/r300/compiler/tests/regalloc_tex_1d_swizzle.test +++ b/src/gallium/drivers/r300/compiler/tests/regalloc_tex_1d_swizzle.test @@ -13,3 +13,4 @@ const[0] = { 0.0000 2.0000 1.0000 0.0000 } 11: MUL temp[21].xyz, temp[17].xyz_, temp[18].xxx_; 12: MUL output[0].xyz, temp[21].xyz_, temp[20].www_; = +TEX temp\[[0-9]\]\.x, temp\[[0-9]\]\.x___, 2D_ARRAY\[0\] -- 1.8.1.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev