nir: Rename replicated-result dot-product instructions

All these instructions replicate the result of a N-component dot-product
to a vec4.  Naming them fdot_replicatedN gives the impression that are
some sort of abstract dot-product that replicates the result to a vecN.
They also deviate from fdph_replicated... which nobody would reasonably
consider naming fdot_replicatedh.

Naming these opcodes fdotN_replicated more closely matches what they
are, and it matches the pattern of fdph_replicated.

I believe that the only reason these opcodes were named this way was
because it simplified the implementation of the binop_reduce function in
nir_opcodes.py.  I made some fairly simple changes to that function, and
I think the end result is ok.

The bulk of the changes come from the sed rename:

    sed --in-place -e 's/fdot_replicated\([234]\)/fdot\1_replicated/g' \
        $(grep -r 'fdot_replicated[234]' src/)

v2: Use a named parameter to binop_reduce instead of using
isinstance(name, str).  Suggested by Jason.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5725>
This commit is contained in:
Ian Romanick
2020-06-20 14:33:57 -07:00
committed by Marge Bot
parent 8cee9ce750
commit 67956689bb
5 changed files with 22 additions and 21 deletions

View File

@@ -1857,17 +1857,17 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
inst->predicate = predicate;
break;
case nir_op_fdot_replicated2:
case nir_op_fdot2_replicated:
try_immediate_source(instr, op, true);
inst = emit(BRW_OPCODE_DP2, dst, op[0], op[1]);
break;
case nir_op_fdot_replicated3:
case nir_op_fdot3_replicated:
try_immediate_source(instr, op, true);
inst = emit(BRW_OPCODE_DP3, dst, op[0], op[1]);
break;
case nir_op_fdot_replicated4:
case nir_op_fdot4_replicated:
try_immediate_source(instr, op, true);
inst = emit(BRW_OPCODE_DP4, dst, op[0], op[1]);
break;