[Mesa-dev] [PATCH 21/22] nvir/nir: implement vote

Karol Herbst kherbst at redhat.com
Thu Dec 21 15:51:39 UTC 2017


TODO: there is more
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 384127aff5..dda7507d76 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -1338,6 +1338,22 @@ Converter::visit(nir_intrinsic_instr *insn)
       mkOp1(OP_RDSV, TYPE_U32, newDefs[0], sym);
       break;
    }
+   case nir_intrinsic_vote_all:
+   case nir_intrinsic_vote_any: {
+      unsigned subop = 0;
+
+      if (insn->intrinsic == nir_intrinsic_vote_all)
+         subop = NV50_IR_SUBOP_VOTE_ALL;
+      else if (insn->intrinsic == nir_intrinsic_vote_any)
+         subop = NV50_IR_SUBOP_VOTE_ANY;
+
+      LValues &newDefs = convert(&insn->dest);
+      Value *pred = new_LValue(func, FILE_PREDICATE);
+      mkCmp(OP_SET, CC_NE, TYPE_U32, pred, TYPE_U32, getSrc(&insn->src[0], 0), zero);
+      mkOp1(OP_VOTE, TYPE_U32, pred, pred)->subOp = subop;
+      mkCvt(OP_CVT, TYPE_U32, newDefs[0], TYPE_U8, pred);
+      break;
+   }
    default:
       ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[insn->intrinsic].name);
       return false;
-- 
2.14.3



More information about the mesa-dev mailing list