aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/bifrost_compile.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-01 18:31:22 -0400
committerAlyssa Rosenzweig <[email protected]>2020-05-04 11:08:15 -0400
commit201a11a13ad7c9fddd621602b729440532c9a11f (patch)
tree23941df1972d297033400af2593f2b077a182a2f /src/panfrost/bifrost/bifrost_compile.c
parent7d867f787f9ada8b67e4d8ee6e9e388b6d6bc9bd (diff)
pan/bi: Add float-only mode to condition fusing
Useful for discards. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4883>
Diffstat (limited to 'src/panfrost/bifrost/bifrost_compile.c')
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c18
1 files changed, 14 insertions, 4 deletions
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 */