diff --git a/src/panfrost/compiler/valhall/test/test-packing.cpp b/src/panfrost/compiler/valhall/test/test-packing.cpp index 0a7bb8783c0..376583091ea 100644 --- a/src/panfrost/compiler/valhall/test/test-packing.cpp +++ b/src/panfrost/compiler/valhall/test/test-packing.cpp @@ -29,7 +29,7 @@ #define CASE(instr, expected) \ do { \ - uint64_t _value = va_pack_instr(instr); \ + uint64_t _value = va_pack_instr(instr, 10); \ if (_value != expected) { \ fprintf(stderr, "Got %" PRIx64 ", expected %" PRIx64 "\n", _value, \ (uint64_t)expected); \ diff --git a/src/panfrost/compiler/valhall/va_compiler.h b/src/panfrost/compiler/valhall/va_compiler.h index 24d71b3536b..f78584ea105 100644 --- a/src/panfrost/compiler/valhall/va_compiler.h +++ b/src/panfrost/compiler/valhall/va_compiler.h @@ -44,7 +44,7 @@ void va_assign_slots(bi_context *ctx); void va_insert_flow_control_nops(bi_context *ctx); void va_merge_flow(bi_context *ctx); void va_mark_last(bi_context *ctx); -uint64_t va_pack_instr(const bi_instr *I); +uint64_t va_pack_instr(const bi_instr *I, unsigned arch); static inline unsigned va_fau_page(enum bir_fau value) diff --git a/src/panfrost/compiler/valhall/va_pack.c b/src/panfrost/compiler/valhall/va_pack.c index 74ae571d14c..8ebe3002091 100644 --- a/src/panfrost/compiler/valhall/va_pack.c +++ b/src/panfrost/compiler/valhall/va_pack.c @@ -408,7 +408,7 @@ va_pack_rhadd(const bi_instr *I) } static uint64_t -va_pack_alu(const bi_instr *I) +va_pack_alu(const bi_instr *I, unsigned arch) { struct va_opcode_info info = valhall_opcodes[I->op]; uint64_t hex = 0; @@ -506,7 +506,10 @@ va_pack_alu(const bi_instr *I) hex |= ((uint64_t)I->varying_name) << 12; /* instead of index */ else if (I->op == BI_OPCODE_LD_VAR_BUF_IMM_F16 || I->op == BI_OPCODE_LD_VAR_BUF_IMM_F32) { - hex |= ((uint64_t)I->index) << 16; + if (arch >= 11) + hex |= ((uint64_t)I->index) << 8; + else + hex |= ((uint64_t)I->index) << 16; } else if (I->op == BI_OPCODE_LD_VAR_IMM || I->op == BI_OPCODE_LD_VAR_FLAT_IMM) { hex |= ((uint64_t)I->table) << 8; @@ -791,7 +794,7 @@ va_pack_register_format(const bi_instr *I) } uint64_t -va_pack_instr(const bi_instr *I) +va_pack_instr(const bi_instr *I, unsigned arch) { struct va_opcode_info info = valhall_opcodes[I->op]; @@ -969,7 +972,7 @@ va_pack_instr(const bi_instr *I) if (!info.exact && I->op != BI_OPCODE_NOP) invalid_instruction(I, "opcode"); - hex |= va_pack_alu(I); + hex |= va_pack_alu(I, arch); break; } @@ -1105,7 +1108,7 @@ bi_pack_valhall(bi_context *ctx, struct util_dynarray *emission) if (I->op == BI_OPCODE_BRANCHZ_I16) va_lower_branch_target(ctx, block, I); - uint64_t hex = va_pack_instr(I); + uint64_t hex = va_pack_instr(I, ctx->arch); util_dynarray_append(emission, uint64_t, hex); } }