diff --git a/src/asahi/lib/agx_nir_lower_tilebuffer.c b/src/asahi/lib/agx_nir_lower_tilebuffer.c index 03f1ffa6cba..e252185d218 100644 --- a/src/asahi/lib/agx_nir_lower_tilebuffer.c +++ b/src/asahi/lib/agx_nir_lower_tilebuffer.c @@ -96,7 +96,7 @@ store_tilebuffer(nir_builder *b, struct agx_tilebuffer_layout *tib, } static nir_def * -nir_fsat_signed(nir_builder *b, nir_def *x) +nir_build_fsat_signed(nir_builder *b, nir_def *x) { return nir_fclamp(b, x, nir_imm_floatN_t(b, -1.0, x->bit_size), nir_imm_floatN_t(b, +1.0, x->bit_size)); @@ -108,7 +108,7 @@ nir_fsat_to_format(nir_builder *b, nir_def *x, enum pipe_format format) if (util_format_is_unorm(format)) return nir_fsat(b, x); else if (util_format_is_snorm(format)) - return nir_fsat_signed(b, x); + return nir_build_fsat_signed(b, x); else return x; } diff --git a/src/compiler/nir/nir_lower_blend.c b/src/compiler/nir/nir_lower_blend.c index df37ae8cdef..25d45db8eac 100644 --- a/src/compiler/nir/nir_lower_blend.c +++ b/src/compiler/nir/nir_lower_blend.c @@ -133,7 +133,7 @@ nir_blend_factor_value( } static nir_def * -nir_fsat_signed(nir_builder *b, nir_def *x) +nir_build_fsat_signed(nir_builder *b, nir_def *x) { return nir_fclamp(b, x, nir_imm_floatN_t(b, -1.0, x->bit_size), nir_imm_floatN_t(b, +1.0, x->bit_size)); @@ -145,7 +145,7 @@ nir_fsat_to_format(nir_builder *b, nir_def *x, enum pipe_format format) if (util_format_is_unorm(format)) return nir_fsat(b, x); else if (util_format_is_snorm(format)) - return nir_fsat_signed(b, x); + return nir_build_fsat_signed(b, x); else return x; } diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index fb2290644ac..e2d0333ed73 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -1504,9 +1504,9 @@ unop("pack_2x16_to_unorm_2x10_v3d", tuint32, "pack_2x16_to_unorm_2x10(src0)") # and one 10 bit unorm unop("pack_2x16_to_unorm_10_2_v3d", tuint32, "pack_2x16_to_unorm_10_2(src0)") -# Mali-specific opcodes -unop("fsat_signed_mali", tfloat, ("fmin(fmax(src0, -1.0), 1.0)")) -unop("fclamp_pos_mali", tfloat, ("fmax(src0, 0.0)")) +# These opcodes are used used by Mali and V3D +unop("fsat_signed", tfloat, ("fmin(fmax(src0, -1.0), 1.0)")) +unop("fclamp_pos", tfloat, ("fmax(src0, 0.0)")) opcode("b32fcsel_mdg", 0, tuint, [0, 0, 0], [tbool32, tfloat, tfloat], False, selection, "src0 ? src1 : src2", diff --git a/src/gallium/drivers/lima/ir/lima_nir_algebraic.py b/src/gallium/drivers/lima/ir/lima_nir_algebraic.py index 8719b44d553..3074c839717 100644 --- a/src/gallium/drivers/lima/ir/lima_nir_algebraic.py +++ b/src/gallium/drivers/lima/ir/lima_nir_algebraic.py @@ -39,7 +39,7 @@ lower_ftrunc = [ # PP fuse clamp_positive. Shared with Midgard/Bifrost ppir_algebraic_late = [ - (('fmax', 'a', 0.0), ('fclamp_pos_mali', 'a')), + (('fmax', 'a', 0.0), ('fclamp_pos', 'a')), ] def main(): diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c index 286c187275a..11525409a20 100644 --- a/src/gallium/drivers/lima/ir/pp/nir.c +++ b/src/gallium/drivers/lima/ir/pp/nir.c @@ -151,7 +151,7 @@ static int nir_to_ppir_opcodes[nir_num_opcodes] = { [nir_op_inot] = ppir_op_not, [nir_op_ftrunc] = ppir_op_trunc, [nir_op_fsat] = ppir_op_sat, - [nir_op_fclamp_pos_mali] = ppir_op_clamp_pos, + [nir_op_fclamp_pos] = ppir_op_clamp_pos, }; static bool ppir_emit_alu(ppir_block *block, nir_instr *ni) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index aedf8924dbb..eaea02848a2 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -2643,13 +2643,13 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr) break; } - case nir_op_fsat_signed_mali: { + case nir_op_fsat_signed: { bi_instr *I = bi_fclamp_to(b, sz, dst, s0); I->clamp = BI_CLAMP_CLAMP_M1_1; break; } - case nir_op_fclamp_pos_mali: { + case nir_op_fclamp_pos: { bi_instr *I = bi_fclamp_to(b, sz, dst, s0); I->clamp = BI_CLAMP_CLAMP_0_INF; break; diff --git a/src/panfrost/compiler/bifrost_nir_algebraic.py b/src/panfrost/compiler/bifrost_nir_algebraic.py index dc7268fc1b8..362266569fc 100644 --- a/src/panfrost/compiler/bifrost_nir_algebraic.py +++ b/src/panfrost/compiler/bifrost_nir_algebraic.py @@ -52,9 +52,9 @@ algebraic_late = [ (('fmul', a, 2.0), ('fadd', a, a)), # Fuse Mali-specific clamps - (('fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed_mali', a)), - (('fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed_mali', a)), - (('fmax', a, 0.0), ('fclamp_pos_mali', a)), + (('fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed', a)), + (('fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed', a)), + (('fmax', a, 0.0), ('fclamp_pos', a)), (('b32csel', 'b@32', ('iadd', 'a@32', 1), a), ('iadd', a, ('b2i32', b))), diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 081d1f9bf55..ac6b240bab2 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -832,8 +832,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) ALU_CASE(fabs, fmov); ALU_CASE(fneg, fmov); ALU_CASE(fsat, fmov); - ALU_CASE(fsat_signed_mali, fmov); - ALU_CASE(fclamp_pos_mali, fmov); + ALU_CASE(fsat_signed, fmov); + ALU_CASE(fclamp_pos, fmov); /* For size conversion, we use a move. Ideally though we would squash * these ops together; maybe that has to happen after in NIR as part of @@ -934,9 +934,9 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) outmod = midgard_outmod_keeplo; } else if (instr->op == nir_op_fsat) { outmod = midgard_outmod_clamp_0_1; - } else if (instr->op == nir_op_fsat_signed_mali) { + } else if (instr->op == nir_op_fsat_signed) { outmod = midgard_outmod_clamp_m1_1; - } else if (instr->op == nir_op_fclamp_pos_mali) { + } else if (instr->op == nir_op_fclamp_pos) { outmod = midgard_outmod_clamp_0_inf; } diff --git a/src/panfrost/midgard/midgard_nir_algebraic.py b/src/panfrost/midgard/midgard_nir_algebraic.py index 12a03f8b175..93b2be62794 100644 --- a/src/panfrost/midgard/midgard_nir_algebraic.py +++ b/src/panfrost/midgard/midgard_nir_algebraic.py @@ -51,11 +51,11 @@ algebraic_late = [ (('b32csel', a, 0, 'b@32'), ('iand', ('inot', a), b)), # Fuse sat_signed. This should probably be shared with Bifrost - (('~fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed_mali', a)), - (('~fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed_mali', a)), + (('~fmin', ('fmax', a, -1.0), 1.0), ('fsat_signed', a)), + (('~fmax', ('fmin', a, 1.0), -1.0), ('fsat_signed', a)), # Fuse clamp_positive. This should probably be shared with Utgard/bifrost - (('fmax', a, 0.0), ('fclamp_pos_mali', a)), + (('fmax', a, 0.0), ('fclamp_pos', a)), (('ishl', 'a@16', b), ('u2u16', ('ishl', ('u2u32', a), b))), (('ishr', 'a@16', b), ('i2i16', ('ishr', ('i2i32', a), b))), diff --git a/src/panfrost/util/pan_lower_framebuffer.c b/src/panfrost/util/pan_lower_framebuffer.c index d8e335f3fbb..478424d0bba 100644 --- a/src/panfrost/util/pan_lower_framebuffer.c +++ b/src/panfrost/util/pan_lower_framebuffer.c @@ -202,7 +202,7 @@ static nir_def * pan_fsat(nir_builder *b, nir_def *v, bool is_signed) { if (is_signed) - return nir_fsat_signed_mali(b, v); + return nir_fsat_signed(b, v); else return nir_fsat(b, v); }