[Mesa-dev] [PATCH 3/3] nvc0/ir: simplify predicate logic for GK104 atomic operations

Ilia Mirkin imirkin at alum.mit.edu
Wed Oct 19 21:36:00 UTC 2016


I'd feel better if there were a assert(su->getPredicate()) in there. With that,

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Wed, Oct 19, 2016 at 5:21 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> The predicate is always CC_NOT_P as defined in
> processSurfaceCoordsNVE4(), so we only want to emit OR.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp        | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> index 08b3a28..817fc3c 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> @@ -1965,18 +1965,10 @@ NVC0LoweringPass::handleSurfaceOpNVE4(TexInstruction *su)
>        convertSurfaceFormat(su);
>
>     if (su->op == OP_SUREDB || su->op == OP_SUREDP) {
> -      Value *pred = su->getSrc(2);
> -      CondCode cc = CC_NOT_P;
> -      if (su->getPredicate()) {
> -         pred = bld.getScratch(1, FILE_PREDICATE);
> -         cc = su->cc;
> -         if (cc == CC_NOT_P) {
> -            bld.mkOp2(OP_OR, TYPE_U8, pred, su->getPredicate(), su->getSrc(2));
> -         } else {
> -            bld.mkOp2(OP_AND, TYPE_U8, pred, su->getPredicate(), su->getSrc(2));
> -            pred->getInsn()->src(1).mod = Modifier(NV50_IR_MOD_NOT);
> -         }
> -      }
> +      Value *pred =
> +         bld.mkOp2v(OP_OR, TYPE_U8, bld.getScratch(1, FILE_PREDICATE),
> +                    su->getPredicate(), su->getSrc(2));
> +
>        Instruction *red = bld.mkOp(OP_ATOM, su->dType, bld.getSSA());
>        red->subOp = su->subOp;
>        red->setSrc(0, bld.mkSymbol(FILE_MEMORY_GLOBAL, 0, TYPE_U32, 0));
> @@ -1989,8 +1981,8 @@ NVC0LoweringPass::handleSurfaceOpNVE4(TexInstruction *su)
>        // performed
>        Instruction *mov = bld.mkMov(bld.getSSA(), bld.loadImm(NULL, 0));
>
> -      assert(cc == CC_NOT_P);
> -      red->setPredicate(cc, pred);
> +      assert(su->cc == CC_NOT_P);
> +      red->setPredicate(su->cc, pred);
>        mov->setPredicate(CC_P, pred);
>
>        bld.mkOp2(OP_UNION, TYPE_U32, su->getDef(0),
> --
> 2.10.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list