From: Alyssa Rosenzweig Date: Sat, 12 Dec 2020 02:24:59 +0000 (-0500) Subject: pan/bi: Add bi_nir_round helper X-Git-Tag: upstream/21.0.0~939 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c99fed47089945b8c9fc3f862e4358ce36ca138;p=platform%2Fupstream%2Fmesa.git pan/bi: Add bi_nir_round helper Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index f5b3797..5c2c750 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2036,6 +2036,18 @@ bi_alu_src_index(nir_alu_src src, unsigned comps) return idx; } +static enum bi_round +bi_nir_round(nir_op op) +{ + switch (op) { + case nir_op_fround_even: return BI_ROUND_NONE; + case nir_op_ftrunc: return BI_ROUND_RTZ; + case nir_op_fceil: return BI_ROUND_RTP; + case nir_op_ffloor: return BI_ROUND_RTN; + default: unreachable("invalid nir round op"); + } +} + /* TEXS instructions assume normal 2D f32 operation but are more * space-efficient and with simpler RA/scheduling requirements*/