pan/bi: Preliminary branch packing
Simple == 0 branch packing. Offset is still to-do. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>
This commit is contained in:
committed by
Marge Bot
parent
cd9a08d4f2
commit
9c32956750
@@ -1619,6 +1619,40 @@ bi_pack_add_imath(bi_instruction *ins, bi_registers *regs)
|
||||
return bi_pack_add_2src(ins, regs, op);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add_branch(bi_instruction *ins, bi_registers *regs)
|
||||
{
|
||||
assert(ins->cond == BI_COND_EQ);
|
||||
assert(ins->src[1] == BIR_INDEX_ZERO);
|
||||
|
||||
unsigned zero_ctrl = 0;
|
||||
unsigned size = nir_alu_type_get_type_size(ins->src_types[0]);
|
||||
|
||||
if (size == 16) {
|
||||
/* See BR_SIZE_ZERO swizzle disassembly */
|
||||
zero_ctrl = ins->swizzle[0][0] ? 1 : 2;
|
||||
} else {
|
||||
assert(size == 32);
|
||||
}
|
||||
|
||||
/* EQ swap to NE */
|
||||
bool port_swapped = false;
|
||||
|
||||
/* We assigned the constant port to fetch the branch offset so we can
|
||||
* just passthrough here. We put in the HI slot to match the blob since
|
||||
* that's where the magic flags end up */
|
||||
struct bifrost_branch pack = {
|
||||
.src0 = bi_get_src(ins, regs, 0),
|
||||
.src1 = (zero_ctrl << 1) | !port_swapped,
|
||||
.src2 = BIFROST_SRC_CONST_HI,
|
||||
.cond = BR_COND_EQ,
|
||||
.size = BR_SIZE_ZERO,
|
||||
.op = BIFROST_ADD_OP_BRANCH
|
||||
};
|
||||
|
||||
RETURN_PACKED(pack);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_stage stage)
|
||||
{
|
||||
@@ -1631,7 +1665,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, bi_registers *regs, gl_shader_s
|
||||
case BI_ATEST:
|
||||
return bi_pack_add_atest(clause, bundle.add, regs);
|
||||
case BI_BRANCH:
|
||||
unreachable("Packing todo");
|
||||
return bi_pack_add_branch(bundle.add, regs);
|
||||
case BI_CMP:
|
||||
return bi_pack_add_cmp(bundle.add, regs);
|
||||
case BI_BLEND:
|
||||
|
||||
@@ -734,6 +734,8 @@ enum bifrost_branch_code {
|
||||
BR_ALWAYS = 63,
|
||||
};
|
||||
|
||||
#define BIFROST_ADD_OP_BRANCH (0x0d000 >> 12)
|
||||
|
||||
struct bifrost_branch {
|
||||
unsigned src0 : 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user