From: Ian Romanick <ian.d.roman...@intel.com> On SNB+, the Boolean result is always 0 or ~0, so MOV.nz produces the same effect as AND.nz. However, later cmod propagation passes can handle the MOV.nz, but they cannot handle the AND.nz due to src1 being 1.
Shader-db results: Ivy Bridge (0x0166): total instructions in shared programs: 6324484 -> 6322033 (-0.04%) instructions in affected programs: 644645 -> 642194 (-0.38%) helped: 2667 HURT: 216 GAINED: 0 LOST: 0 Haswell (0x0426): total instructions in shared programs: 5951948 -> 5949497 (-0.04%) instructions in affected programs: 588543 -> 586092 (-0.42%) helped: 2667 HURT: 216 GAINED: 0 LOST: 0 Broadwell (0x162E): total instructions in shared programs: 7040870 -> 7038378 (-0.04%) instructions in affected programs: 591031 -> 588539 (-0.42%) helped: 2678 HURT: 216 GAINED: 0 LOST: 0 No change on other platforms. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> --- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 2f74716..5bacb68 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2584,7 +2584,14 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir) if (!expr || expr->operation == ir_binop_ubo_load) { ir->accept(this); - fs_inst *inst = emit(AND(reg_null_d, this->result, fs_reg(1))); + fs_inst *inst; + + if (brw->gen <= 5) { + inst = emit(AND(reg_null_d, this->result, fs_reg(1))); + } else { + inst = emit(MOV(reg_null_d, this->result)); + } + inst->conditional_mod = BRW_CONDITIONAL_NZ; return; } @@ -2604,7 +2611,11 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir) switch (expr->operation) { case ir_unop_logic_not: - inst = emit(AND(reg_null_d, op[0], fs_reg(1))); + if (brw->gen <= 5) { + inst = emit(AND(reg_null_d, op[0], fs_reg(1))); + } else { + inst = emit(MOV(reg_null_d, op[0])); + } inst->conditional_mod = BRW_CONDITIONAL_Z; break; -- 2.1.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev