intel/eu: Set flag [sub]register number differently for 3src
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 29 May 2018 22:28:36 +0000 (15:28 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 4 Jun 2018 21:03:03 +0000 (14:03 -0700)
Prior to gen8, the flag [sub]register number is in a different spot on
3src instructions than on other instructions.  Starting with Broadwell,
they made it consistent.  This commit fixes bugs that occur when a
conditional modifier gets propagated into a 3src instruction such as a
MAD.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_eu_emit.c

index a660d9eaaa5b96b30c4b5dde7ff8da9095e9e573..412a051bc93a7069d80b7439e1280ee14f42e4cd 100644 (file)
@@ -701,9 +701,16 @@ brw_inst_set_state(const struct gen_device_info *devinfo,
    brw_inst_set_pred_control(devinfo, insn, state->predicate);
    brw_inst_set_pred_inv(devinfo, insn, state->pred_inv);
 
-   brw_inst_set_flag_subreg_nr(devinfo, insn, state->flag_subreg % 2);
-   if (devinfo->gen >= 7)
-      brw_inst_set_flag_reg_nr(devinfo, insn, state->flag_subreg / 2);
+   if (is_3src(devinfo, brw_inst_opcode(devinfo, insn)) &&
+       state->access_mode == BRW_ALIGN_16) {
+      brw_inst_set_3src_a16_flag_subreg_nr(devinfo, insn, state->flag_subreg % 2);
+      if (devinfo->gen >= 7)
+         brw_inst_set_3src_a16_flag_reg_nr(devinfo, insn, state->flag_subreg / 2);
+   } else {
+      brw_inst_set_flag_subreg_nr(devinfo, insn, state->flag_subreg % 2);
+      if (devinfo->gen >= 7)
+         brw_inst_set_flag_reg_nr(devinfo, insn, state->flag_subreg / 2);
+   }
 
    if (devinfo->gen >= 6)
       brw_inst_set_acc_wr_control(devinfo, insn, state->acc_wr_control);