From: Alyssa Rosenzweig Date: Fri, 1 May 2020 22:31:22 +0000 (-0400) Subject: pan/bi: Add float-only mode to condition fusing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=201a11a13ad7c9fddd621602b729440532c9a11f;p=mesa.git pan/bi: Add float-only mode to condition fusing Useful for discards. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index b5027e18b71..3f68ae2ae0c 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -653,8 +653,9 @@ bi_copy_src(bi_instruction *alu, nir_alu_instr *instr, unsigned i, unsigned to, } static void -bi_fuse_csel_cond(bi_instruction *csel, nir_alu_src cond, - unsigned *constants_left, unsigned *constant_shift, unsigned comps) +bi_fuse_cond(bi_instruction *csel, nir_alu_src cond, + unsigned *constants_left, unsigned *constant_shift, + unsigned comps, bool float_only) { /* Bail for vector weirdness */ if (cond.swizzle[0] != 0) @@ -677,6 +678,15 @@ bi_fuse_csel_cond(bi_instruction *csel, nir_alu_src cond, if (bcond == BI_COND_ALWAYS) return; + /* Some instructions can't compare ints */ + if (float_only) { + nir_alu_type T = nir_op_infos[alu->op].input_types[0]; + T = nir_alu_type_get_base_type(T); + + if (T != nir_type_float) + return; + } + /* We found one, let's fuse it in */ csel->cond = bcond; bi_copy_src(csel, alu, 0, 0, constants_left, constant_shift, comps); @@ -817,8 +827,8 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr) /* TODO: Reenable cond fusing when we can split up registers * when scheduling */ #if 0 - bi_fuse_csel_cond(&alu, instr->src[0], - &constants_left, &constant_shift, comps); + bi_fuse_cond(&alu, instr->src[0], + &constants_left, &constant_shift, comps, false); #endif } else if (alu.type == BI_BITWISE) { /* Implicit shift argument... at some point we should fold */