[Mesa-dev] [PATCH 16/21] i965: Define consistent interface to enable instruction conditional modifiers.

Francisco Jerez currojerez at riseup.net
Tue Apr 28 10:08:32 PDT 2015


---
 src/mesa/drivers/dri/i965/brw_ir_fs.h    | 11 +++++++++++
 src/mesa/drivers/dri/i965/brw_ir_svec4.h | 17 +++++++++++++++++
 src/mesa/drivers/dri/i965/brw_ir_vec4.h  | 11 +++++++++++
 3 files changed, 39 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index b2dfa00..d6f40ee 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -351,4 +351,15 @@ exec_predicate(enum brw_predicate pred, fs_inst *inst)
    return exec_predicate_inv(pred, false, inst);
 }
 
+/**
+ * Write the result of evaluating the condition given by \p mod to a flag
+ * register.
+ */
+static inline fs_inst *
+exec_condmod(enum brw_conditional_mod mod, fs_inst *inst)
+{
+   inst->conditional_mod = mod;
+   return inst;
+}
+
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_ir_svec4.h b/src/mesa/drivers/dri/i965/brw_ir_svec4.h
index 58c04c1..4be3554 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_svec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_svec4.h
@@ -407,6 +407,23 @@ namespace brw {
    {
       return exec_predicate_inv(pred, false, inst);
    }
+
+   /**
+    * Write the result of evaluating the condition given by \p mod to a flag
+    * register.  This will typically be accompanied by exec_reduce() to select
+    * how the per-component flag results are to be combined to give the final
+    * flag result.
+    */
+   inline svec4_inst *
+   exec_condmod(brw_conditional_mod mod, svec4_inst *inst)
+   {
+      for (unsigned i = 0; i < ARRAY_SIZE(inst->v); ++i) {
+         if (inst->v[i])
+            exec_condmod(mod, inst->v[i]);
+      }
+
+      return inst;
+   }
 }
 
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
index 325e661..c4021d8 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -352,6 +352,17 @@ exec_predicate(enum brw_predicate pred, vec4_instruction *inst)
 {
    return exec_predicate_inv(pred, false, inst);
 }
+
+/**
+ * Write the result of evaluating the condition given by \p mod to a flag
+ * register.
+ */
+inline vec4_instruction *
+exec_condmod(enum brw_conditional_mod mod, vec4_instruction *inst)
+{
+   inst->conditional_mod = mod;
+   return inst;
+}
 } /* namespace brw */
 
 #endif
-- 
2.3.5



More information about the mesa-dev mailing list