mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 00:30:11 +01:00
nir: Use nir_type_convert instead of nir_type_conversion_op
In a future commit, nit_type_conversion_op won't be able to handle i2b (and in a much later commit f2b), so switch many users to the fully featured function. No shader-db or fossil-db changes on any Intel platform. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15121>
This commit is contained in:
parent
1197030727
commit
ded3572947
2 changed files with 6 additions and 9 deletions
|
|
@ -480,10 +480,9 @@ nir_convert_with_rounding(nir_builder *b,
|
|||
} else {
|
||||
trivial_convert = false;
|
||||
}
|
||||
if (trivial_convert) {
|
||||
nir_op op = nir_type_conversion_op(src_type, dest_type, round);
|
||||
return nir_build_alu(b, op, src, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (trivial_convert)
|
||||
return nir_type_convert(b, src, src_type, dest_type, round);
|
||||
|
||||
nir_ssa_def *dest = src;
|
||||
|
||||
|
|
|
|||
|
|
@ -143,14 +143,12 @@ lower_alu_instr(nir_builder *b, nir_instr *instr_, UNUSED void *cb_data)
|
|||
if (src0->bit_size < 32) {
|
||||
/* Just do the math in 32-bit space and shift the result */
|
||||
nir_alu_type base_type = nir_op_infos[instr->op].output_type;
|
||||
nir_op upcast_op = nir_type_conversion_op(base_type | src0->bit_size, base_type | 32, nir_rounding_mode_undef);
|
||||
nir_op downscast_op = nir_type_conversion_op(base_type | 32, base_type | src0->bit_size, nir_rounding_mode_undef);
|
||||
|
||||
nir_ssa_def *src0_32 = nir_build_alu(b, upcast_op, src0, NULL, NULL, NULL);
|
||||
nir_ssa_def *src1_32 = nir_build_alu(b, upcast_op, src1, NULL, NULL, NULL);
|
||||
nir_ssa_def *src0_32 = nir_type_convert(b, src0, base_type, base_type | 32, nir_rounding_mode_undef);
|
||||
nir_ssa_def *src1_32 = nir_type_convert(b, src1, base_type, base_type | 32, nir_rounding_mode_undef);
|
||||
nir_ssa_def *dest_32 = nir_imul(b, src0_32, src1_32);
|
||||
nir_ssa_def *dest_shifted = nir_ishr(b, dest_32, nir_imm_int(b, src0->bit_size));
|
||||
lowered = nir_build_alu(b, downscast_op, dest_shifted, NULL, NULL, NULL);
|
||||
lowered = nir_type_convert(b, dest_shifted, base_type, base_type | src0->bit_size, nir_rounding_mode_undef);
|
||||
} else {
|
||||
nir_ssa_def *cshift = nir_imm_int(b, src0->bit_size / 2);
|
||||
nir_ssa_def *cmask = nir_imm_intN_t(b, (1ull << (src0->bit_size / 2)) - 1, src0->bit_size);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue