i965: Return NONE from brw_swap_cmod on unknown input.
authorMatt Turner <mattst88@gmail.com>
Mon, 11 Aug 2014 18:12:43 +0000 (11:12 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 12 Aug 2014 18:09:45 +0000 (11:09 -0700)
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@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_eu.c
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp

index b4d5d88288364f47f1f079ca481c7f7094139645..990597286d88c69326f6f88dd7bf8f43765244e1 100644 (file)
@@ -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;
    }
 }
 
index 071620279b23f9838bd042231dde02e47ea0933d..498e0782f69c256286d6f35196ce27655494e53d 100644 (file)
@@ -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
                 */
index 390448ad801a7650274793129850cab8cb8c1371..28f162df5ba1da415d80098f4a524e4924bd8763 100644 (file)
@@ -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.
             */