r600/sfn: override slot count for IfInstr
authorGert Wollny <gert.wollny@collabora.com>
Fri, 21 Jul 2023 15:00:06 +0000 (17:00 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 26 Jul 2023 19:33:42 +0000 (19:33 +0000)
We have one slot for the predicate (todo fix this value)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24297>

src/gallium/drivers/r600/sfn/sfn_instr_controlflow.cpp
src/gallium/drivers/r600/sfn/sfn_instr_controlflow.h

index 44fd4d5..72d9eac 100644 (file)
@@ -152,6 +152,16 @@ IfInstr::is_equal_to(const IfInstr& rhs) const
    return m_predicate->equal_to(*rhs.m_predicate);
 }
 
+uint32_t IfInstr::slots() const
+{
+   /* If we hava a literal value in the predicate evaluation, then
+    * we need at most two alu slots, otherwise it's just one. */
+   for (auto s : m_predicate->sources())
+      if (s->as_literal())
+         return 2;
+   return 1;
+};
+
 void
 IfInstr::accept(ConstInstrVisitor& visitor) const
 {
index d09f8b2..5ad309b 100644 (file)
@@ -82,6 +82,8 @@ public:
    AluInstr *predicate() const { return m_predicate; }
    AluInstr *predicate() { return m_predicate; }
 
+   uint32_t slots() const override;
+
    void accept(ConstInstrVisitor& visitor) const override;
    void accept(InstrVisitor& visitor) override;