Mesa (master): i965: Return NONE from brw_swap_cmod on unknown input.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Aug 12 18:15:59 UTC 2014


Module: Mesa
Branch: master
Commit: e005c1148db04cb706a65392c2b0beda19efa0b1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e005c1148db04cb706a65392c2b0beda19efa0b1

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Aug 11 11:12:43 2014 -0700

i965: Return NONE from brw_swap_cmod on unknown input.

Comparing ~0u with a packed enum (i.e., 1 byte) always evaluates to
false. Shouldn't gcc warn about this?

Reported-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_eu.c                      |    2 +-
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp   |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index b4d5d88..9905972 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -84,7 +84,7 @@ brw_swap_cmod(uint32_t cmod)
    case BRW_CONDITIONAL_LE:
       return BRW_CONDITIONAL_GE;
    default:
-      return ~0;
+      return BRW_CONDITIONAL_NONE;
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 0716202..498e078 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -440,7 +440,7 @@ try_constant_propagate(struct brw_context *brw, fs_inst *inst,
             enum brw_conditional_mod new_cmod;
 
             new_cmod = brw_swap_cmod(inst->conditional_mod);
-            if (new_cmod != ~0u) {
+            if (new_cmod != BRW_CONDITIONAL_NONE) {
                /* Fit this constant in by swapping the operands and
                 * flipping the test
                 */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 390448a..28f162d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -165,7 +165,7 @@ try_constant_propagate(struct brw_context *brw, vec4_instruction *inst,
 	 enum brw_conditional_mod new_cmod;
 
 	 new_cmod = brw_swap_cmod(inst->conditional_mod);
-	 if (new_cmod != ~0u) {
+	 if (new_cmod != BRW_CONDITIONAL_NONE) {
 	    /* Fit this constant in by swapping the operands and
 	     * flipping the test.
 	     */




More information about the mesa-commit mailing list