From 7b78af8e00271ff7f52b04591bbf3bec6c382c98 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 26 Mar 2019 04:01:33 +0000 Subject: [PATCH] panfrost/midgard: Expand fge lowering to more types Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/midgard/helpers.h | 1 + .../drivers/panfrost/midgard/midgard_compile.c | 14 +++++++++++--- .../panfrost/midgard/midgard_nir_algebraic.py | 3 --- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/helpers.h b/src/gallium/drivers/panfrost/midgard/helpers.h index 0d553d87917..84db2de84d1 100644 --- a/src/gallium/drivers/panfrost/midgard/helpers.h +++ b/src/gallium/drivers/panfrost/midgard/helpers.h @@ -218,6 +218,7 @@ static unsigned alu_opcode_props[256] = { /* For vector comparisons, use ball etc */ [midgard_alu_op_feq] = UNITS_MOST, [midgard_alu_op_fne] = UNITS_MOST, + [midgard_alu_op_fle] = UNITS_MOST, [midgard_alu_op_flt] = UNITS_MOST, [midgard_alu_op_ieq] = UNITS_MOST, [midgard_alu_op_ine] = UNITS_MOST, diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 0c7bc28f00a..d6ed0008596 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -1052,11 +1052,19 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) ALU_CASE(b32any_inequal3, ibany_neq); ALU_CASE(b32any_inequal4, ibany_neq); - /* For greater-or-equal, we use less-or-equal and flip the + /* For greater-or-equal, we lower to less-or-equal and flip the * arguments */ - case nir_op_ige32: { - op = midgard_alu_op_ile; + case nir_op_fge: + case nir_op_fge32: + case nir_op_ige32: + case nir_op_uge32: { + op = + instr->op == nir_op_fge ? midgard_alu_op_fle : + instr->op == nir_op_fge32 ? midgard_alu_op_fle : + instr->op == nir_op_ige32 ? midgard_alu_op_ile : + instr->op == nir_op_uge32 ? midgard_alu_op_ule : + 0; /* Swap via temporary */ nir_alu_src temp = instr->src[1]; diff --git a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py index e5af36539d6..8aad4b128c4 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py +++ b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py @@ -30,9 +30,6 @@ a = 'a' b = 'b' algebraic = [ - # TODO: Should really be a fle, maybe not lowered in algebraic? - (('fge', a, b), ('flt', b, a)), - # XXX: We have hw ops for this, just unknown atm.. #(('fsign@32', a), ('i2f32@32', ('isign', ('f2i32@32', ('fmul', a, 0x43800000))))) #(('fsign', a), ('fcsel', ('fge', a, 0), 1.0, ('fcsel', ('flt', a, 0.0), -1.0, 0.0))) -- 2.30.2