nir/builder: Merge nir_[if]mov_alu into one nir_mov_alu helper

Unless source modifiers are present, fmov and imov are the same.
There's no good reason for having two helpers.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Jason Ekstrand
2019-05-06 11:26:27 -05:00
parent cd73b6174b
commit 22421ca7be
6 changed files with 18 additions and 36 deletions

View File

@@ -492,26 +492,10 @@ nir_vec(nir_builder *build, nir_ssa_def **comp, unsigned num_components)
return nir_build_alu_src_arr(build, nir_op_vec(num_components), comp);
}
/**
* Similar to nir_fmov, but takes a nir_alu_src instead of a nir_ssa_def.
*/
static inline nir_ssa_def *
nir_fmov_alu(nir_builder *build, nir_alu_src src, unsigned num_components)
{
nir_alu_instr *mov = nir_alu_instr_create(build->shader, nir_op_fmov);
nir_ssa_dest_init(&mov->instr, &mov->dest.dest, num_components,
nir_src_bit_size(src.src), NULL);
mov->exact = build->exact;
mov->dest.write_mask = (1 << num_components) - 1;
mov->src[0] = src;
nir_builder_instr_insert(build, &mov->instr);
return &mov->dest.dest.ssa;
}
static inline nir_ssa_def *
nir_imov_alu(nir_builder *build, nir_alu_src src, unsigned num_components)
nir_mov_alu(nir_builder *build, nir_alu_src src, unsigned num_components)
{
assert(!src.abs && !src.negate);
nir_alu_instr *mov = nir_alu_instr_create(build->shader, nir_op_imov);
nir_ssa_dest_init(&mov->instr, &mov->dest.dest, num_components,
nir_src_bit_size(src.src), NULL);
@@ -544,7 +528,7 @@ nir_swizzle(nir_builder *build, nir_ssa_def *src, const unsigned *swiz,
if (num_components == src->num_components && is_identity_swizzle)
return src;
return nir_imov_alu(build, alu_src, num_components);
return nir_mov_alu(build, alu_src, num_components);
}
/* Selects the right fdot given the number of components in each source. */
@@ -838,7 +822,7 @@ nir_ssa_for_src(nir_builder *build, nir_src src, int num_components)
for (int j = 0; j < 4; j++)
alu.swizzle[j] = j;
return nir_imov_alu(build, alu, num_components);
return nir_mov_alu(build, alu, num_components);
}
/**
@@ -859,7 +843,7 @@ nir_ssa_for_alu_src(nir_builder *build, nir_alu_instr *instr, unsigned srcn)
(memcmp(src->swizzle, trivial_swizzle, num_components) == 0))
return src->src.ssa;
return nir_imov_alu(build, *src, num_components);
return nir_mov_alu(build, *src, num_components);
}
static inline unsigned