aco: move src1 to vgpr instead of using VOP3 for VOP2 instructions during isel
authorDaniel Schürmann <daniel@schuermann.dev>
Mon, 20 Apr 2020 12:02:26 +0000 (13:02 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 20 Apr 2020 15:12:50 +0000 (15:12 +0000)
Is simpler and helps a couple of shaders.
Totals from affected shaders: (Vega)
Code Size: 16341296 -> 16335460 (-0.04 %) bytes

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4642>

src/amd/compiler/aco_instruction_selection.cpp

index 1043bb2d2c0dbf54e8bb15104cedbf970df1385b..7a42bee0f70b6b037c8fc67103da24fd4952a554 100644 (file)
@@ -561,16 +561,8 @@ void emit_vop2_instruction(isel_context *ctx, nir_alu_instr *instr, aco_opcode o
          Temp t = src0;
          src0 = src1;
          src1 = t;
-      } else if (src0.type() == RegType::vgpr &&
-                 op != aco_opcode::v_madmk_f32 &&
-                 op != aco_opcode::v_madak_f32 &&
-                 op != aco_opcode::v_madmk_f16 &&
-                 op != aco_opcode::v_madak_f16) {
-         /* If the instruction is not commutative, we emit a VOP3A instruction */
-         bld.vop2_e64(op, Definition(dst), src0, src1);
-         return;
       } else {
-         src1 = bld.copy(bld.def(RegType::vgpr, src1.size()), src1); //TODO: as_vgpr
+         src1 = as_vgpr(ctx, src1);
       }
    }