i965: Optimize OPCODE_CMP by using BRW_SEL to choose results.
authorEric Anholt <eric@anholt.net>
Fri, 19 Mar 2010 18:44:43 +0000 (11:44 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 22 Mar 2010 22:04:46 +0000 (15:04 -0700)
Tested with piglit glsl-fs-sqrt-branch, fp-cmp.vpfp.

src/mesa/drivers/dri/i965/brw_wm_emit.c

index 1869fd06d5a392dc1ec1631e94435b2495de6ca0..5abc0672f3f180c5b17a574a5e20f34239fb5e26 100644 (file)
@@ -620,14 +620,10 @@ void emit_cmp(struct brw_compile *p,
 
    for (i = 0; i < 4; i++) {
       if (mask & (1<<i)) {     
-        brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
-        brw_MOV(p, dst[i], arg2[i]);
-        brw_set_saturate(p, 0);
-
         brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0[i], brw_imm_f(0));
 
         brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
-        brw_MOV(p, dst[i], arg1[i]);
+        brw_SEL(p, dst[i], arg1[i], arg2[i]);
         brw_set_saturate(p, 0);
         brw_set_predicate_control_flag_value(p, 0xff);
       }