aco: fix subdword copies on GFX6-GFX7
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 26 May 2020 07:38:27 +0000 (09:38 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 3 Jun 2020 17:48:42 +0000 (19:48 +0200)
SDWA is only GFX8+. Use v_mov_b32 since the upper 16 bits don't matter.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5227>

src/amd/compiler/aco_builder_h.py

index 2b56e04e50104ca6a17c5851873b6fea6d49ec1b..eb655471c902deb937d64adb50e662d5cc87d1b3 100644 (file)
@@ -382,13 +382,17 @@ public:
       } else if (op.bytes() > 2) {
          return pseudo(aco_opcode::p_create_vector, dst, op);
       } else if (dst.regClass().is_subdword()) {
-        aco_ptr<SDWA_instruction> sdwa{create_instruction<SDWA_instruction>(aco_opcode::v_mov_b32, asSDWA(Format::VOP1), 1, 1)};
-        sdwa->operands[0] = op;
-        sdwa->definitions[0] = dst;
-        sdwa->sel[0] = op.bytes() == 1 ? sdwa_ubyte : sdwa_uword;
-        sdwa->dst_sel = dst.bytes() == 1 ? sdwa_ubyte : sdwa_uword;
-        sdwa->dst_preserve = true;
-        return insert(std::move(sdwa));
+        if (program->chip_class >= GFX8) {
+            aco_ptr<SDWA_instruction> sdwa{create_instruction<SDWA_instruction>(aco_opcode::v_mov_b32, asSDWA(Format::VOP1), 1, 1)};
+            sdwa->operands[0] = op;
+            sdwa->definitions[0] = dst;
+            sdwa->sel[0] = op.bytes() == 1 ? sdwa_ubyte : sdwa_uword;
+            sdwa->dst_sel = dst.bytes() == 1 ? sdwa_ubyte : sdwa_uword;
+            sdwa->dst_preserve = true;
+            return insert(std::move(sdwa));
+        } else {
+            return vop1(aco_opcode::v_mov_b32, dst, op);
+        }
       } else {
         unreachable("Unhandled case in bld.copy()");
       }