From 8ab5c97895daa86d0ac777b60f31737e491a22f3 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 1 May 2020 18:36:42 -0400 Subject: [PATCH] pan/bi: Fuse conditions into discard_if Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 3f68ae2ae0c..056d44718b3 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -365,6 +365,11 @@ bi_emit_discard(bi_context *ctx, nir_intrinsic_instr *instr) bi_emit(ctx, discard); } +static void +bi_fuse_cond(bi_instruction *csel, nir_alu_src cond, + unsigned *constants_left, unsigned *constant_shift, + unsigned comps, bool float_only); + static void bi_emit_discard_if(bi_context *ctx, nir_intrinsic_instr *instr) { @@ -381,6 +386,17 @@ bi_emit_discard_if(bi_context *ctx, nir_intrinsic_instr *instr) }, }; + /* Try to fuse in the condition */ + unsigned constants_left = 1, constant_shift = 0; + + /* Scalar so no swizzle */ + nir_alu_src wrap = { + .src = instr->src[0] + }; + + /* May or may not succeed but we're optimistic */ + bi_fuse_cond(&discard, wrap, &constants_left, &constant_shift, 1, true); + bi_emit(ctx, discard); } -- 2.30.2