intel/fs: Slightly restructure emitting nir_op_imul_32x16 and nir_op_umul_32x16
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Feb 2021 02:49:06 +0000 (18:49 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 9 Nov 2022 21:34:26 +0000 (21:34 +0000)
There are no immediate values at this point, so all of this code was
bunk. :face_palm:

Reviewed-by: Marcin Ĺšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19602>

src/intel/compiler/brw_fs_nir.cpp

index 7e62df4..c85983f 100644 (file)
@@ -1316,6 +1316,10 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
    case nir_op_imul_32x16:
    case nir_op_umul_32x16: {
       const bool ud = instr->op == nir_op_umul_32x16;
+      const enum brw_reg_type word_type =
+         ud ? BRW_REGISTER_TYPE_UW : BRW_REGISTER_TYPE_W;
+      const enum brw_reg_type dword_type =
+         ud ? BRW_REGISTER_TYPE_UD : BRW_REGISTER_TYPE_D;
 
       assert(nir_dest_bit_size(instr->dest.dest) == 32);
 
@@ -1325,18 +1329,10 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
        */
       assert(devinfo->ver >= 7);
 
-      if (op[1].file == IMM)
-         op[1] = ud ? brw_imm_uw(op[1].ud) : brw_imm_w(op[1].d);
-      else {
-         const enum brw_reg_type word_type =
-            ud ? BRW_REGISTER_TYPE_UW : BRW_REGISTER_TYPE_W;
-
-         op[1] = subscript(op[1], word_type, 0);
-      }
-
-      const enum brw_reg_type dword_type =
-         ud ? BRW_REGISTER_TYPE_UD : BRW_REGISTER_TYPE_D;
+      /* Before copy propagation there are no immediate values. */
+      assert(op[0].file != IMM && op[1].file != IMM);
 
+      op[1] = subscript(op[1], word_type, 0);
       bld.MUL(result, retype(op[0], dword_type), op[1]);
       break;
    }