[Mesa-dev] [PATCH 1/3] i965: Add reads_accumulator_implicitly() function.

Matt Turner mattst88 at gmail.com
Wed Apr 9 13:47:17 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_shader.cpp | 16 ++++++++++++++++
 src/mesa/drivers/dri/i965/brw_shader.h   |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index f194437..c8796b3 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -664,6 +664,22 @@ backend_instruction::can_do_saturate() const
 }
 
 bool
+backend_instruction::reads_accumulator_implicitly() const
+{
+   switch (opcode) {
+   case BRW_OPCODE_MAC:
+   case BRW_OPCODE_MACH:
+   /* FINISHME: Enable these if we ever start emitting them.
+    * case BRW_OPCODE_SADA:
+    * case BRW_OPCODE_SADA2:
+    */
+      return true;
+   default:
+      return false;
+   }
+}
+
+bool
 backend_instruction::has_side_effects() const
 {
    switch (opcode) {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 6bd7dc8..9ef08e5 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -47,6 +47,7 @@ public:
    bool is_control_flow() const;
    bool can_do_source_mods() const;
    bool can_do_saturate() const;
+   bool reads_accumulator_implicitly() const;
 
    /**
     * True if the instruction has side effects other than writing to
-- 
1.8.3.2



More information about the mesa-dev mailing list