nir: use more nir_fmul_imm

This simplifies things a bit. Note that in some cases, the arguments are
swapped, because multiplications are commutative, and nir_fmul_imm only
allows the second operand to be an immediate.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23179>
This commit is contained in:
Erik Faye-Lund
2023-05-06 08:49:32 +02:00
committed by Marge Bot
parent ea2eade57b
commit 20d619cd84
18 changed files with 43 additions and 54 deletions

View File

@@ -504,8 +504,7 @@ lower_barycentric_at_offset(nir_builder *b, nir_instr *instr, void *data)
assert(intrin->src[0].ssa);
nir_ssa_def *offset =
nir_imin(b, nir_imm_int(b, 7),
nir_f2i32(b, nir_fmul(b, nir_imm_float(b, 16),
intrin->src[0].ssa)));
nir_f2i32(b, nir_fmul_imm(b, intrin->src[0].ssa, 16)));
nir_instr_rewrite_src(instr, &intrin->src[0], nir_src_for_ssa(offset));