mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-08 11:50:29 +01:00
pan/bi: Pack ld_var_addr
Choo choo. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4276>
This commit is contained in:
parent
7321a17c6a
commit
409e4f8a49
4 changed files with 42 additions and 1 deletions
|
|
@ -119,6 +119,8 @@ bi_assign_uniform_constant_single(
|
|||
return assigned;
|
||||
|
||||
bi_foreach_src(ins, s) {
|
||||
if (s == 0 && ins->type == BI_LOAD_VAR_ADDRESS) continue;
|
||||
|
||||
if (ins->src[s] & BIR_INDEX_CONSTANT) {
|
||||
/* TODO: lo/hi matching? */
|
||||
uint64_t cons = ins->constant.u64;
|
||||
|
|
@ -549,6 +551,36 @@ bi_pack_add_ld_ubo(bi_clause *clause, bi_instruction *ins, struct bi_registers *
|
|||
return bi_pack_add_2src(ins, regs, ops[components - 1]);
|
||||
}
|
||||
|
||||
static enum bifrost_ldst_type
|
||||
bi_pack_ldst_type(nir_alu_type T)
|
||||
{
|
||||
switch (T) {
|
||||
case nir_type_float16: return BIFROST_LDST_F16;
|
||||
case nir_type_float32: return BIFROST_LDST_F32;
|
||||
case nir_type_int32: return BIFROST_LDST_I32;
|
||||
case nir_type_uint32: return BIFROST_LDST_U32;
|
||||
default: unreachable("Invalid type loaded");
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add_ld_var_addr(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
|
||||
{
|
||||
/* Only direct loads supported */
|
||||
assert(ins->src[0] == BIR_INDEX_CONSTANT);
|
||||
|
||||
struct bifrost_ld_var_addr pack = {
|
||||
.src0 = bi_get_src(ins, regs, 1, false),
|
||||
.src1 = bi_get_src(ins, regs, 2, false),
|
||||
.location = ins->constant.u64,
|
||||
.type = bi_pack_ldst_type(ins->src_types[3]),
|
||||
.op = BIFROST_ADD_OP_LD_VAR_ADDR
|
||||
};
|
||||
|
||||
bi_write_data_register(clause, ins);
|
||||
RETURN_PACKED(pack);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add_atest(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
|
||||
{
|
||||
|
|
@ -613,6 +645,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
|
|||
case BI_LOAD_VAR:
|
||||
return bi_pack_add_ld_vary(clause, bundle.add, regs);
|
||||
case BI_LOAD_VAR_ADDRESS:
|
||||
return bi_pack_add_ld_var_addr(clause, bundle.add, regs);
|
||||
case BI_MINMAX:
|
||||
case BI_MOV:
|
||||
case BI_FMOV:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
|
|||
[BI_LOAD_UNIFORM] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_ATTR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_VAR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
|
||||
[BI_LOAD_VAR_ADDRESS] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
|
||||
[BI_LOAD_VAR_ADDRESS] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_DATA_REG_DEST,
|
||||
[BI_MINMAX] = BI_GENERIC | BI_SCHED_ALL,
|
||||
[BI_MOV] = BI_SCHED_ALL,
|
||||
[BI_FMOV] = BI_MODS | BI_SCHED_ALL,
|
||||
|
|
|
|||
|
|
@ -260,6 +260,8 @@ enum bifrost_ldst_type {
|
|||
BIFROST_LDST_U32 = 3
|
||||
};
|
||||
|
||||
#define BIFROST_ADD_OP_LD_VAR_ADDR (0x18000 >> 10)
|
||||
|
||||
struct bifrost_ld_var_addr {
|
||||
unsigned src0 : 3;
|
||||
unsigned src1 : 3;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,12 @@ static void
|
|||
bi_emit_st_vary(bi_context *ctx, nir_intrinsic_instr *instr)
|
||||
{
|
||||
bi_instruction address = bi_load(BI_LOAD_VAR_ADDRESS, instr);
|
||||
address.src[1] = BIR_INDEX_REGISTER | 61; /* TODO: RA */
|
||||
address.src[2] = BIR_INDEX_REGISTER | 62;
|
||||
address.src[3] = 0;
|
||||
address.src_types[1] = nir_type_uint32;
|
||||
address.src_types[2] = nir_type_uint32;
|
||||
address.src_types[3] = nir_intrinsic_type(instr);
|
||||
address.dest = bi_make_temp(ctx);
|
||||
address.dest_type = nir_type_uint64;
|
||||
address.writemask = (1 << 8) - 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue