mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 22:50:32 +01:00
pan/bi: Fix bi_get_immediate with multiple imms
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>
This commit is contained in:
parent
df69304ac8
commit
86c2a6b9fe
3 changed files with 17 additions and 8 deletions
|
|
@ -162,7 +162,7 @@ bi_assign_uniform_constant_single(
|
|||
if (ins->src[s] & BIR_INDEX_CONSTANT) {
|
||||
bool hi = false;
|
||||
bool b64 = nir_alu_type_get_type_size(ins->src_types[s]) > 32;
|
||||
uint64_t cons = bi_get_immediate(ins, ins->src[s]);
|
||||
uint64_t cons = bi_get_immediate(ins, s);
|
||||
unsigned idx = bi_lookup_constant(clause, cons, &hi, b64);
|
||||
unsigned f = bi_constant_field(idx) | (cons & 0xF);
|
||||
|
||||
|
|
@ -944,7 +944,7 @@ bi_pack_add_ld_vary(bi_clause *clause, bi_instruction *ins, struct bi_registers
|
|||
|
||||
if (ins->src[0] & BIR_INDEX_CONSTANT) {
|
||||
/* Direct uses address field directly */
|
||||
packed_addr = bi_get_immediate(ins, ins->src[0]);
|
||||
packed_addr = bi_get_immediate(ins, 0);
|
||||
assert(packed_addr < 0b1000);
|
||||
} else {
|
||||
/* Indirect gets an extra source */
|
||||
|
|
@ -1051,7 +1051,7 @@ bi_pack_add_ld_var_addr(bi_clause *clause, bi_instruction *ins, struct bi_regist
|
|||
struct bifrost_ld_var_addr pack = {
|
||||
.src0 = bi_get_src(ins, regs, 1, false),
|
||||
.src1 = bi_get_src(ins, regs, 2, false),
|
||||
.location = bi_get_immediate(ins, ins->src[0]),
|
||||
.location = bi_get_immediate(ins, 0),
|
||||
.type = bi_pack_ldst_type(ins->src_types[3]),
|
||||
.op = BIFROST_ADD_OP_LD_VAR_ADDR
|
||||
};
|
||||
|
|
@ -1066,7 +1066,7 @@ bi_pack_add_ld_attr(bi_clause *clause, bi_instruction *ins, struct bi_registers
|
|||
struct bifrost_ld_attr pack = {
|
||||
.src0 = bi_get_src(ins, regs, 1, false),
|
||||
.src1 = bi_get_src(ins, regs, 2, false),
|
||||
.location = bi_get_immediate(ins, ins->src[0]),
|
||||
.location = bi_get_immediate(ins, 0),
|
||||
.channels = MALI_POSITIVE(bi_load32_components(ins)),
|
||||
.type = bi_pack_ldst_type(ins->dest_type),
|
||||
.op = BIFROST_ADD_OP_LD_ATTR
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ bi_print_index(FILE *fp, bi_instruction *ins, unsigned index, unsigned s)
|
|||
if (index & BIR_INDEX_UNIFORM)
|
||||
fprintf(fp, "u%u", index & ~BIR_INDEX_UNIFORM);
|
||||
else if (index & BIR_INDEX_CONSTANT)
|
||||
fprintf(fp, "#0x%" PRIx64, bi_get_immediate(ins, index));
|
||||
fprintf(fp, "#0x%" PRIx64, bi_get_immediate(ins, s));
|
||||
else if (index & BIR_INDEX_ZERO)
|
||||
fprintf(fp, "#0");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -140,9 +140,18 @@ bi_bytemask_of_read_components(bi_instruction *ins, unsigned node)
|
|||
uint64_t
|
||||
bi_get_immediate(bi_instruction *ins, unsigned index)
|
||||
{
|
||||
assert(index & BIR_INDEX_CONSTANT);
|
||||
unsigned shift = index & ~BIR_INDEX_CONSTANT;
|
||||
return ins->constant.u64 >> shift;
|
||||
unsigned v = ins->src[index];
|
||||
assert(v & BIR_INDEX_CONSTANT);
|
||||
unsigned shift = v & ~BIR_INDEX_CONSTANT;
|
||||
uint64_t shifted = ins->constant.u64 >> shift;
|
||||
|
||||
/* Mask off the accessed part */
|
||||
unsigned sz = nir_alu_type_get_type_size(ins->src_types[index]);
|
||||
|
||||
if (sz == 64)
|
||||
return shifted;
|
||||
else
|
||||
return shifted & ((1ull << sz) - 1);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue