Mesa (main): intel/compiler: Fix missing break in switch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 23 00:42:49 UTC 2021


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

Author: Sagar Ghuge <sagar.ghuge at intel.com>
Date:   Mon Jul 19 19:29:03 2021 -0700

intel/compiler: Fix missing break in switch

CoverityID: 1487496

Fixes: cde9ca616d7 "intel/compiler: Make decision based on source type instead of opcode"
Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11985>

---

 src/intel/compiler/brw_fs_combine_constants.cpp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/intel/compiler/brw_fs_combine_constants.cpp b/src/intel/compiler/brw_fs_combine_constants.cpp
index 43c01bcc537..a0ff72107f1 100644
--- a/src/intel/compiler/brw_fs_combine_constants.cpp
+++ b/src/intel/compiler/brw_fs_combine_constants.cpp
@@ -376,6 +376,8 @@ static bool
 can_promote_src_as_imm(const struct intel_device_info *devinfo, fs_inst *inst,
                        unsigned src_idx)
 {
+   bool can_promote = false;
+
    /* Experiment shows that we can only support src0 as immediate */
    if (src_idx != 0)
       return false;
@@ -386,31 +388,36 @@ can_promote_src_as_imm(const struct intel_device_info *devinfo, fs_inst *inst,
    /* TODO - Fix the codepath below to use a bfloat16 immediate on XeHP,
     *        since HF/F mixed mode has been removed from the hardware.
     */
-   switch(inst->src[src_idx].type) {
+   switch (inst->src[src_idx].type) {
    case BRW_REGISTER_TYPE_F: {
       uint16_t hf;
       if (representable_as_hf(inst->src[src_idx].f, &hf)) {
          inst->src[src_idx] = retype(brw_imm_uw(hf), BRW_REGISTER_TYPE_HF);
-         return true;
+         can_promote = true;
       }
+      break;
    }
    case BRW_REGISTER_TYPE_W: {
       int16_t w;
       if (representable_as_w(inst->src[src_idx].d, &w)) {
          inst->src[src_idx] = brw_imm_w(w);
-         return true;
+         can_promote = true;
       }
+      break;
    }
    case BRW_REGISTER_TYPE_UW: {
       uint16_t uw;
       if (representable_as_uw(inst->src[src_idx].ud, &uw)) {
          inst->src[src_idx] = brw_imm_uw(uw);
-         return true;
+         can_promote = true;
       }
+      break;
    }
    default:
-      return false;
+      break;
    }
+
+   return can_promote;
 }
 
 bool



More information about the mesa-commit mailing list