diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-05-01 18:36:42 -0400 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2020-05-04 11:08:15 -0400 |
commit | 8ab5c97895daa86d0ac777b60f31737e491a22f3 (patch) | |
tree | 5bd64b1699824a232d954a752f5e955022221a40 /src/panfrost/bifrost | |
parent | 201a11a13ad7c9fddd621602b729440532c9a11f (diff) |
pan/bi: Fuse conditions into discard_if
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4883>
Diffstat (limited to 'src/panfrost/bifrost')
-rw-r--r-- | src/panfrost/bifrost/bifrost_compile.c | 16 |
1 files changed, 16 insertions, 0 deletions
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 @@ -366,6 +366,11 @@ bi_emit_discard(bi_context *ctx, nir_intrinsic_instr *instr) } 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) { nir_src cond = instr->src[0]; @@ -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); } |