Module: Mesa
Branch: main
Commit: 8eaa0db13f38810019cdfc7773e6ac4c70a9269c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8eaa0db13f38810019cdfc7773e6ac4c70a9269c

Author: Sviatoslav Peleshko <sviatoslav.peles...@globallogic.com>
Date:   Wed Oct 11 13:14:24 2023 +0300

intel/tools/i965_asm: Don't override flag reg from cond modifier

Both predication and conditional modifier use the same flag, but in
assembly it's specified only once. If the instruction already has a
flag from predication we should not override it with zeroes.

Signed-off-by: Sviatoslav Peleshko <sviatoslav.peles...@globallogic.com>
Reviewed-by: Sagar Ghuge <sagar.gh...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25657>

---

 src/intel/tools/i965_gram.y | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/intel/tools/i965_gram.y b/src/intel/tools/i965_gram.y
index 225d8bed7bb..bf675ead1ad 100644
--- a/src/intel/tools/i965_gram.y
+++ b/src/intel/tools/i965_gram.y
@@ -722,15 +722,14 @@ unaryinstruction:
                brw_inst_set_cond_modifier(p->devinfo, brw_last_inst,
                                           $4.cond_modifier);
 
-               if (p->devinfo->ver >= 7) {
-                       if ($2 != BRW_OPCODE_DIM) {
-                               brw_inst_set_flag_reg_nr(p->devinfo,
-                                                        brw_last_inst,
-                                                        $4.flag_reg_nr);
-                               brw_inst_set_flag_subreg_nr(p->devinfo,
-                                                           brw_last_inst,
-                                                           $4.flag_subreg_nr);
-                       }
+               if (p->devinfo->ver >= 7 && $2 != BRW_OPCODE_DIM &&
+                   !brw_inst_flag_reg_nr(p->devinfo, brw_last_inst)) {
+                       brw_inst_set_flag_reg_nr(p->devinfo,
+                                                brw_last_inst,
+                                                $4.flag_reg_nr);
+                       brw_inst_set_flag_subreg_nr(p->devinfo,
+                                                   brw_last_inst,
+                                                   $4.flag_subreg_nr);
                }
 
                if ($7.file != BRW_IMMEDIATE_VALUE) {
@@ -778,7 +777,8 @@ binaryinstruction:
                brw_inst_set_cond_modifier(p->devinfo, brw_last_inst,
                                           $4.cond_modifier);
 
-               if (p->devinfo->ver >= 7) {
+               if (p->devinfo->ver >= 7 &&
+                   !brw_inst_flag_reg_nr(p->devinfo, brw_last_inst)) {
                        brw_inst_set_flag_reg_nr(p->devinfo, brw_last_inst,
                                                 $4.flag_reg_nr);
                        brw_inst_set_flag_subreg_nr(p->devinfo, brw_last_inst,
@@ -830,15 +830,14 @@ binaryaccinstruction:
                brw_inst_set_cond_modifier(p->devinfo, brw_last_inst,
                                           $4.cond_modifier);
 
-               if (p->devinfo->ver >= 7) {
-                       if (!brw_inst_flag_reg_nr(p->devinfo, brw_last_inst)) {
-                               brw_inst_set_flag_reg_nr(p->devinfo,
-                                                        brw_last_inst,
-                                                        $4.flag_reg_nr);
-                               brw_inst_set_flag_subreg_nr(p->devinfo,
-                                                           brw_last_inst,
-                                                           $4.flag_subreg_nr);
-                       }
+               if (p->devinfo->ver >= 7 &&
+                   !brw_inst_flag_reg_nr(p->devinfo, brw_last_inst)) {
+                       brw_inst_set_flag_reg_nr(p->devinfo,
+                                                brw_last_inst,
+                                                $4.flag_reg_nr);
+                       brw_inst_set_flag_subreg_nr(p->devinfo,
+                                                   brw_last_inst,
+                                                   $4.flag_subreg_nr);
                }
 
                brw_inst_set_saturate(p->devinfo, brw_last_inst, $3);
@@ -925,7 +924,7 @@ ternaryinstruction:
                brw_inst_set_cond_modifier(p->devinfo, brw_last_inst,
                                           $4.cond_modifier);
 
-               if (p->devinfo->ver >= 7) {
+               if (p->devinfo->ver >= 7 && p->devinfo->ver < 12) {
                        brw_inst_set_3src_a16_flag_reg_nr(p->devinfo, 
brw_last_inst,
                                                 $4.flag_reg_nr);
                        brw_inst_set_3src_a16_flag_subreg_nr(p->devinfo, 
brw_last_inst,

Reply via email to