From d7cd49d54b9d548e62290c7525d1924b95778a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Wed, 21 Sep 2022 08:31:50 +0200 Subject: [PATCH] aco/tests: Add post-RA optimizer testcase for partially overwritten VCC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Daniel Schürmann Part-of: --- .../compiler/tests/test_optimizer_postRA.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/amd/compiler/tests/test_optimizer_postRA.cpp b/src/amd/compiler/tests/test_optimizer_postRA.cpp index 5edbf494a98..5e77de22cee 100644 --- a/src/amd/compiler/tests/test_optimizer_postRA.cpp +++ b/src/amd/compiler/tests/test_optimizer_postRA.cpp @@ -75,6 +75,24 @@ BEGIN_TEST(optimizer_postRA.vcmp) //; del b, c, d, e, f + { + /* When part of VCC is overwritten inbetween, don't optimize. */ + + //! s2: %b:vcc = v_cmp_eq_u32 0, %a:v[0] + //! s2: %c:s[0-1], s1: %d:scc = s_and_b64 %b:vcc, %x:exec + //! s1: %f:s[107] = s_mov_b32 0 + //! s2: %e:s[2-3] = p_cbranch_z %d:scc + //! p_unit_test 1, %e:s[2-3], %f:vcc + auto vcmp = bld.vopc(aco_opcode::v_cmp_eq_u32, bld.def(bld.lm, vcc), Operand::zero(), + Operand(v_in, reg_v0)); + auto sand = bld.sop2(Builder::s_and, bld.def(bld.lm, reg_s0), bld.def(s1, scc), bld.vcc(vcmp), Operand(exec, bld.lm)); + auto ovrwr = bld.sop1(aco_opcode::s_mov_b32, bld.def(s1, vcc_hi), Operand::zero()); + auto br = bld.branch(aco_opcode::p_cbranch_z, bld.def(s2, reg_s2), bld.scc(sand.def(1).getTemp())); + writeout(1, Operand(br, reg_s2), Operand(ovrwr, vcc)); + } + + //; del b, c, d, e, f + { /* When the result of VOPC goes to an SGPR pair other than VCC, don't optimize */