panfrost: Inline max rt into compilers
[mesa.git] / src / panfrost / bifrost / bifrost_compile.c
index 3973892d91a49c3c17c13efb53e9f8aa2149ea37..0c7942f7e9548e39bd5d3ec03e99be2e8a58f425 100644 (file)
@@ -169,7 +169,7 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
                 .vector_channels = 4
         };
 
                 .vector_channels = 4
         };
 
-        assert(blend.blend_location < BIFROST_MAX_RENDER_TARGET_COUNT);
+        assert(blend.blend_location < 8);
         assert(ctx->blend_types);
         assert(blend.src_types[0]);
         ctx->blend_types[blend.blend_location] = blend.src_types[0];
         assert(ctx->blend_types);
         assert(blend.src_types[0]);
         ctx->blend_types[blend.blend_location] = blend.src_types[0];
@@ -512,6 +512,9 @@ bi_class_for_nir_alu(nir_op op)
         case nir_op_isub:
                 return BI_IMATH;
 
         case nir_op_isub:
                 return BI_IMATH;
 
+        case nir_op_imul:
+                return BI_IMUL;
+
         case nir_op_iand:
         case nir_op_ior:
         case nir_op_ixor:
         case nir_op_iand:
         case nir_op_ior:
         case nir_op_ixor:
@@ -527,6 +530,7 @@ bi_class_for_nir_alu(nir_op op)
         BI_CASE_CMP(nir_op_ige)
         BI_CASE_CMP(nir_op_ieq)
         BI_CASE_CMP(nir_op_ine)
         BI_CASE_CMP(nir_op_ige)
         BI_CASE_CMP(nir_op_ieq)
         BI_CASE_CMP(nir_op_ine)
+        BI_CASE_CMP(nir_op_uge)
                 return BI_CMP;
 
         case nir_op_b8csel:
                 return BI_CMP;
 
         case nir_op_b8csel:
@@ -596,6 +600,7 @@ bi_class_for_nir_alu(nir_op op)
 
         case nir_op_frcp:
         case nir_op_frsq:
 
         case nir_op_frcp:
         case nir_op_frsq:
+        case nir_op_iabs:
                 return BI_SPECIAL;
 
         default:
                 return BI_SPECIAL;
 
         default:
@@ -618,6 +623,7 @@ bi_cond_for_nir(nir_op op, bool soft)
 
         BI_CASE_CMP(nir_op_fge)
         BI_CASE_CMP(nir_op_ige)
 
         BI_CASE_CMP(nir_op_fge)
         BI_CASE_CMP(nir_op_ige)
+        BI_CASE_CMP(nir_op_uge)
                 return BI_COND_GE;
 
         BI_CASE_CMP(nir_op_feq)
                 return BI_COND_GE;
 
         BI_CASE_CMP(nir_op_feq)
@@ -803,6 +809,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         case nir_op_isub:
                 alu.op.imath = BI_IMATH_SUB;
                 break;
         case nir_op_isub:
                 alu.op.imath = BI_IMATH_SUB;
                 break;
+        case nir_op_iabs:
+                alu.op.special = BI_SPECIAL_IABS;
+                break;
         case nir_op_inot:
                 /* no dedicated bitwise not, but we can invert sources. convert to ~a | 0 */
                 alu.op.bitwise = BI_BITWISE_OR;
         case nir_op_inot:
                 /* no dedicated bitwise not, but we can invert sources. convert to ~a | 0 */
                 alu.op.bitwise = BI_BITWISE_OR;
@@ -819,6 +828,9 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
                 alu.src_types[2] = alu.src_types[1];
                 alu.src[1] = BIR_INDEX_ZERO;
                 break;
                 alu.src_types[2] = alu.src_types[1];
                 alu.src[1] = BIR_INDEX_ZERO;
                 break;
+        case nir_op_imul:
+                alu.op.imul = BI_IMUL_IMUL;
+                break;
         case nir_op_fmax:
         case nir_op_imax:
         case nir_op_umax:
         case nir_op_fmax:
         case nir_op_imax:
         case nir_op_umax:
@@ -838,6 +850,7 @@ emit_alu(bi_context *ctx, nir_alu_instr *instr)
         BI_CASE_CMP(nir_op_ieq)
         BI_CASE_CMP(nir_op_fne)
         BI_CASE_CMP(nir_op_ine)
         BI_CASE_CMP(nir_op_ieq)
         BI_CASE_CMP(nir_op_fne)
         BI_CASE_CMP(nir_op_ine)
+        BI_CASE_CMP(nir_op_uge)
                 alu.cond = bi_cond_for_nir(instr->op, false);
                 break;
         case nir_op_fround_even:
                 alu.cond = bi_cond_for_nir(instr->op, false);
                 break;
         case nir_op_fround_even: