From 8e82641cf5397e279d0ba8a560acbe33ec31db3f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 11 Dec 2020 22:00:01 -0500 Subject: [PATCH] pan/bi: Add bi_cmpf_nir helper Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 5c2c7509197..397a7c257ba 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2048,6 +2048,33 @@ bi_nir_round(nir_op op) } } +static enum bi_cmpf +bi_cmpf_nir(nir_op op) +{ + switch (op) { + case nir_op_flt32: + case nir_op_ilt32: + case nir_op_ult32: + return BI_CMPF_LT; + + case nir_op_fge32: + case nir_op_ige32: + case nir_op_uge32: + return BI_CMPF_GE; + + case nir_op_feq32: + case nir_op_ieq32: + return BI_CMPF_EQ; + + case nir_op_fneu32: + case nir_op_ine32: + return BI_CMPF_NE; + + default: + unreachable("Invalid compare"); + } +} + /* TEXS instructions assume normal 2D f32 operation but are more * space-efficient and with simpler RA/scheduling requirements*/