Mesa (master): i965: Don't copy prop source mods into instructions that can 't take them.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Oct 14 18:19:29 UTC 2013


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Sep 19 19:48:22 2013 -0700

i965: Don't copy prop source mods into instructions that can't take them.

---

 src/mesa/drivers/dri/i965/brw_fs.cpp     |    3 +++
 src/mesa/drivers/dri/i965/brw_shader.cpp |   19 +++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_shader.h   |    1 +
 src/mesa/drivers/dri/i965/brw_vec4.cpp   |    3 +++
 4 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e5d6e4b..85995df 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -368,6 +368,9 @@ fs_visitor::can_do_source_mods(fs_inst *inst)
    if (inst->is_send_from_grf())
       return false;
 
+   if (!inst->can_do_source_mods())
+      return false;
+
    return true;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 61c4bf5..256f9b2 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -568,6 +568,25 @@ backend_instruction::is_control_flow()
    }
 }
 
+bool
+backend_instruction::can_do_source_mods()
+{
+   switch (opcode) {
+   case BRW_OPCODE_ADDC:
+   case BRW_OPCODE_BFE:
+   case BRW_OPCODE_BFI1:
+   case BRW_OPCODE_BFI2:
+   case BRW_OPCODE_BFREV:
+   case BRW_OPCODE_CBIT:
+   case BRW_OPCODE_FBH:
+   case BRW_OPCODE_FBL:
+   case BRW_OPCODE_SUBB:
+      return false;
+   default:
+      return true;
+   }
+}
+
 void
 backend_visitor::dump_instructions()
 {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 4dbd38d..21a0ad6 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -44,6 +44,7 @@ public:
    bool is_tex();
    bool is_math();
    bool is_control_flow();
+   bool can_do_source_mods();
 
    enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 149a1a0..bfd0106 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -222,6 +222,9 @@ vec4_visitor::can_do_source_mods(vec4_instruction *inst)
    if (inst->is_send_from_grf())
       return false;
 
+   if (!inst->can_do_source_mods())
+      return false;
+
    return true;
 }
 




More information about the mesa-commit mailing list