[Mesa-dev] [v2 PATCH 15/16] i965/fs: Remove try_emit_saturate

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Jul 7 06:57:12 PDT 2014


Now that saturate is implemented natively as instruction,
we can cut down on unneeded functionality.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.h           |  1 -
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 37 ----------------------------
 2 files changed, 38 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 537f10e..966f0f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -388,7 +388,6 @@ public:
                  const fs_reg &a);
    void emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg &dst,
                     const fs_reg &src0, const fs_reg &src1);
-   bool try_emit_saturate(ir_expression *ir);
    bool try_emit_mad(ir_expression *ir);
    void try_replace_with_sel();
    bool opt_peephole_sel();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 01750bc..68507b8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -267,41 +267,6 @@ fs_visitor::emit_minmax(enum brw_conditional_mod conditionalmod, const fs_reg &d
    }
 }
 
-/* Instruction selection: Produce a MOV.sat instead of
- * MIN(MAX(val, 0), 1) when possible.
- */
-bool
-fs_visitor::try_emit_saturate(ir_expression *ir)
-{
-   ir_rvalue *sat_val = ir->as_rvalue_to_saturate();
-
-   if (!sat_val)
-      return false;
-
-   fs_inst *pre_inst = (fs_inst *) this->instructions.get_tail();
-
-   sat_val->accept(this);
-   fs_reg src = this->result;
-
-   fs_inst *last_inst = (fs_inst *) this->instructions.get_tail();
-
-   /* If the last instruction from our accept() didn't generate our
-    * src, generate a saturated MOV
-    */
-   fs_inst *modify = get_instruction_generating_reg(pre_inst, last_inst, src);
-   if (!modify || modify->regs_written != 1) {
-      this->result = fs_reg(this, ir->type);
-      fs_inst *inst = emit(MOV(this->result, src));
-      inst->saturate = true;
-   } else {
-      modify->saturate = true;
-      this->result = src;
-   }
-
-
-   return true;
-}
-
 bool
 fs_visitor::try_emit_mad(ir_expression *ir)
 {
@@ -353,8 +318,6 @@ fs_visitor::visit(ir_expression *ir)
 
    assert(ir->get_num_operands() <= 3);
 
-   if (try_emit_saturate(ir))
-      return;
    if (ir->operation == ir_binop_add) {
       if (try_emit_mad(ir))
 	 return;
-- 
1.9.1



More information about the mesa-dev mailing list