aco: test self-intersecting copies when src=higher
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 4 Dec 2020 10:26:06 +0000 (10:26 +0000)
committerMarge Bot <eric+marge@anholt.net>
Fri, 4 Dec 2020 14:44:48 +0000 (14:44 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7798>

src/amd/compiler/tests/test_to_hw_instr.cpp

index bca1ae223975d131f5cfbf6915a2c46ef6a552ec..bf3c498874726c2c987673ffc2cf607556956d14 100644 (file)
@@ -473,3 +473,28 @@ BEGIN_TEST(to_hw_instr.subdword_constant)
       finish_to_hw_instr_test();
    }
 END_TEST
+
+BEGIN_TEST(to_hw_instr.self_intersecting_swap)
+   if (!setup_cs(NULL, GFX9))
+      return;
+
+   PhysReg reg_v1{257};
+   PhysReg reg_v2{258};
+   PhysReg reg_v3{259};
+   PhysReg reg_v7{263};
+
+   //>> p_unit_test 0
+   //! v1: %0:v[1],  v1: %0:v[2] = v_swap_b32 %0:v[2], %0:v[1]
+   //! v1: %0:v[2],  v1: %0:v[3] = v_swap_b32 %0:v[3], %0:v[2]
+   //! v1: %0:v[3],  v1: %0:v[7] = v_swap_b32 %0:v[7], %0:v[3]
+   //! s_endpgm
+   bld.pseudo(aco_opcode::p_unit_test, Operand(0u));
+   //v[1:2] = v[2:3]
+   //v3 = v7
+   //v7 = v1
+   bld.pseudo(aco_opcode::p_parallelcopy,
+              Definition(reg_v1, v2), Definition(reg_v3, v1), Definition(reg_v7, v1),
+              Operand(reg_v2, v2), Operand(reg_v7, v1), Operand(reg_v1, v1));
+
+   finish_to_hw_instr_test();
+END_TEST