From: Alyssa Rosenzweig Date: Fri, 1 May 2020 22:36:42 +0000 (-0400) Subject: pan/bi: Fuse conditions into discard_if X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ab5c97895daa86d0ac777b60f31737e491a22f3;p=mesa.git pan/bi: Fuse conditions into discard_if Signed-off-by: Alyssa Rosenzweig Part-of: --- 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); }