Mesa (master): i965: Don' t emit saturates for instructions without destinations.

Matt Turner mattst88 at kemper.freedesktop.org
Fri Feb 20 05:17:39 UTC 2015


Module: Mesa
Branch: master
Commit: f8b435ae6a27fa2274ff166639b22d0b36d68c49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8b435ae6a27fa2274ff166639b22d0b36d68c49

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Feb  9 22:21:21 2015 -0800

i965: Don't emit saturates for instructions without destinations.

We were special casing OPCODE_END but no other instructions that have no
destination, like OPCODE_KIL, leading us to emitting MOVs with null
destinations.

total instructions in shared programs: 5705243 -> 5701539 (-0.06%)
instructions in affected programs:     124104 -> 120400 (-2.98%)
helped:                                904

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs_fp.cpp   |    2 +-
 src/mesa/drivers/dri/i965/brw_vec4_vp.cpp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
index 382a54a..d22de0e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
@@ -522,7 +522,7 @@ fs_visitor::emit_fragment_program_code()
       /* To handle saturates, we emit a MOV with a saturate bit, which
        * optimization should fold into the preceding instructions when safe.
        */
-      if (fpi->Opcode != OPCODE_END) {
+      if (_mesa_num_inst_dst_regs(fpi->Opcode) != 0) {
          fs_reg real_dst = get_fp_dst_reg(&fpi->DstReg);
 
          for (int i = 0; i < 4; i++) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
index 60a0f24..a5a5e7b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
@@ -386,7 +386,7 @@ vec4_vs_visitor::emit_program_code()
       }
 
       /* Copy the temporary back into the actual destination register. */
-      if (vpi->Opcode != OPCODE_END) {
+      if (_mesa_num_inst_dst_regs(vpi->Opcode) != 0) {
          emit(MOV(get_vp_dst_reg(vpi->DstReg), src_reg(dst)));
       }
    }




More information about the mesa-commit mailing list