OSDN Git Service

panfrost/midgard: Expand fge lowering to more types
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 26 Mar 2019 04:01:33 +0000 (04:01 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 26 Mar 2019 23:36:09 +0000 (23:36 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/helpers.h
src/gallium/drivers/panfrost/midgard/midgard_compile.c
src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py

index 0d553d8..84db2de 100644 (file)
@@ -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,
index 0c7bc28..d6ed000 100644 (file)
@@ -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];
index e5af365..8aad4b1 100644 (file)
@@ -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)))