From: Samuel Pitoiset Date: Thu, 1 Oct 2020 08:11:33 +0000 (+0200) Subject: aco/tests: add disassembler tests to reproduce the add3+clamp crash X-Git-Tag: upstream/21.0.0~4706 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18fd6274b26ffef43567d1c290876a6119b8866a;p=platform%2Fupstream%2Fmesa.git aco/tests: add disassembler tests to reproduce the add3+clamp crash Like some other v_add instructions, LLVM fails to disassemble v_add3_u32 + clamp. Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- diff --git a/src/amd/compiler/tests/test_assembler.cpp b/src/amd/compiler/tests/test_assembler.cpp index ae4247e..23f02dd3 100644 --- a/src/amd/compiler/tests/test_assembler.cpp +++ b/src/amd/compiler/tests/test_assembler.cpp @@ -227,3 +227,40 @@ BEGIN_TEST(assembler.long_jump.constaddr) finish_assembler_test(); END_TEST + +BEGIN_TEST(assembler.v_add3) + for (unsigned i = GFX9; i <= GFX10; i++) { + if (!setup_cs(NULL, (chip_class)i)) + continue; + + //~gfx9>> v_add3_u32 v0, 0, 0, 0 ; d1ff0000 02010080 + //~gfx10>> v_add3_u32 v0, 0, 0, 0 ; d76d0000 02010080 + aco_ptr add3{create_instruction(aco_opcode::v_add3_u32, Format::VOP3A, 3, 1)}; + add3->operands[0] = Operand(0u); + add3->operands[1] = Operand(0u); + add3->operands[2] = Operand(0u); + add3->definitions[0] = Definition(PhysReg(0), v1); + bld.insert(std::move(add3)); + + finish_assembler_test(); + } +END_TEST + +BEGIN_TEST(assembler.v_add3_clamp) + for (unsigned i = GFX9; i <= GFX10; i++) { + if (!setup_cs(NULL, (chip_class)i)) + continue; + + //~gfx9>> integer addition + clamp ; d1ff8000 02010080 + //~gfx10>> integer addition + clamp ; d76d8000 02010080 + aco_ptr add3{create_instruction(aco_opcode::v_add3_u32, Format::VOP3A, 3, 1)}; + add3->operands[0] = Operand(0u); + add3->operands[1] = Operand(0u); + add3->operands[2] = Operand(0u); + add3->definitions[0] = Definition(PhysReg(0), v1); + add3->clamp = 1; + bld.insert(std::move(add3)); + + finish_assembler_test(); + } +END_TEST