From ecd9a3fed5dff3997cc279468b816dfac281fc76 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 10 Jun 2021 20:37:12 -0400 Subject: [PATCH] pan/bi: Handle fsat_signed and fclamp_pos Translates to Mali-specific clamps. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 90d396add99..907bf13f3ac 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -1784,6 +1784,18 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) break; } + case nir_op_fsat_signed: { + bi_instr *I = bi_fadd_to(b, sz, dst, s0, bi_negzero(), BI_ROUND_NONE); + I->clamp = BI_CLAMP_CLAMP_M1_1; + break; + } + + case nir_op_fclamp_pos: { + bi_instr *I = bi_fadd_to(b, sz, dst, s0, bi_negzero(), BI_ROUND_NONE); + I->clamp = BI_CLAMP_CLAMP_0_INF; + break; + } + case nir_op_fneg: bi_fadd_to(b, sz, dst, bi_neg(s0), bi_negzero(), BI_ROUND_NONE); break;