pan/bi: Use bi_emit_collect_to() for load_const

This helper is shorter and it also caches the result in the collect
cache so it can be used as a vector (or, in this case, a 64-bit value).

Cc: mesa-stable
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39244>
This commit is contained in:
Faith Ekstrand 2026-01-09 10:13:11 -05:00 committed by Marge Bot
parent 9f926c28bb
commit 87f924d91f

View file

@ -2760,14 +2760,11 @@ bi_emit_load_const(bi_builder *b, nir_load_const_instr *instr)
bi_mov_i32_to(b, bi_get_index(instr->def.index), bi_imm_u32(acc));
} else {
uint32_t imm_2x32[2] = { acc & 0xffffffff, (acc >> 32) & 0xffffffff };
bi_index tempa = bi_temp(b->shader);
bi_index tempb = bi_temp(b->shader);
bi_mov_i32_to(b, tempa, bi_imm_u32(imm_2x32[0]));
bi_mov_i32_to(b, tempb, bi_imm_u32(imm_2x32[1]));
bi_index temp[2] = { bi_temp(b->shader), bi_temp(b->shader) };
bi_mov_i32_to(b, temp[0], bi_imm_u32(imm_2x32[0]));
bi_mov_i32_to(b, temp[1], bi_imm_u32(imm_2x32[1]));
bi_instr *collect = bi_collect_i32_to(b, bi_get_index(instr->def.index), 2);
collect->src[0] = tempa;
collect->src[1] = tempb;
bi_emit_collect_to(b, bi_get_index(instr->def.index), temp, 2);
}
}