"As mach is used to generate part of the 64-bit DWord integer results, saturation modifier should not be used. In fact, saturation modifier should not be used for any of these four instructions."
I believe this never actually occurred anyway, and no tests should be effected. Similar to previous patches, this actually applies to the whole MUL/MACH macro operation, but it's easier to just catch it at MACH, since that is the only thing we use MACH for. Signed-off-by: Ben Widawsky <b...@bwidawsk.net> --- src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp | 2 +- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +- src/mesa/drivers/dri/i965/brw_shader.cpp | 8 ++++++-- src/mesa/drivers/dri/i965/brw_shader.h | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp index a9966a4..840b86f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp @@ -72,7 +72,7 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block) inst->saturate = false; progress = true; } else if (src_end_ip <= ip || inst->dst.equals(inst->src[0])) { - if (scan_inst->can_do_saturate()) { + if (scan_inst->can_do_saturate(v->brw)) { scan_inst->saturate = true; inst->saturate = false; progress = true; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 98f1b0d..96ed17e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -350,7 +350,7 @@ fs_visitor::try_emit_saturate(ir_expression *ir) */ fs_inst *modify = get_instruction_generating_reg(pre_inst, last_inst, src); if (modify && modify->regs_written == modify->dst.width / 8 && - modify->can_do_saturate()) { + modify->can_do_saturate(this->brw)) { modify->saturate = true; this->result = src; return true; diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 3891f43..006efe3 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -702,7 +702,7 @@ backend_instruction::can_do_source_mods() const } bool -backend_instruction::can_do_saturate() const +backend_instruction::can_do_saturate(const struct brw_context *brw) const { switch (opcode) { case BRW_OPCODE_ADD: @@ -717,7 +717,6 @@ backend_instruction::can_do_saturate() const case BRW_OPCODE_LINE: case BRW_OPCODE_LRP: case BRW_OPCODE_MAC: - case BRW_OPCODE_MACH: case BRW_OPCODE_MAD: case BRW_OPCODE_MATH: case BRW_OPCODE_MOV: @@ -740,6 +739,11 @@ backend_instruction::can_do_saturate() const case SHADER_OPCODE_SIN: case SHADER_OPCODE_SQRT: return true; + case BRW_OPCODE_MACH: + if (brw->gen < 8) + return true; + else + return false; default: return false; } diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h index 05434a7..4c4bb1a 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.h +++ b/src/mesa/drivers/dri/i965/brw_shader.h @@ -86,7 +86,7 @@ struct backend_instruction : public exec_node { bool is_math() const; bool is_control_flow() const; bool can_do_source_mods() const; - bool can_do_saturate() const; + bool can_do_saturate(const struct brw_context *brw) const; bool reads_accumulator_implicitly() const; bool writes_accumulator_implicitly(struct brw_context *brw) const; -- 2.2.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev