aco: use VOP3 v_mov_b16 if necessary

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Backport-to: 24.3
(cherry picked from commit 2b10930b48)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
Rhys Perry
2025-01-08 12:35:58 +00:00
committed by Dylan Baker
parent d9a841d799
commit 9e4fd4793a
3 changed files with 27 additions and 1 deletions

View File

@@ -1194,7 +1194,7 @@
"description": "aco: use VOP3 v_mov_b16 if necessary",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -1266,6 +1266,9 @@ emit_v_mov_b16(Builder& bld, Definition dst, Operand op)
Instruction* instr = bld.vop1(aco_opcode::v_mov_b16, dst, op);
instr->valu().opsel[0] = op.physReg().byte() == 2;
instr->valu().opsel[3] = dst.physReg().byte() == 2;
if (op.physReg().reg() < 256 && instr->valu().opsel[0])
instr->format = asVOP3(instr->format);
}
void

View File

@@ -766,3 +766,26 @@ BEGIN_TEST(to_hw_instr.pack2x16_constant)
finish_to_hw_instr_test();
}
END_TEST
BEGIN_TEST(to_hw_instr.mov_b16_sgpr_src)
if (!setup_cs(NULL, GFX11))
return;
//>> p_unit_test 0
//! v2b: %0:v[0][0:16] = v_mov_b16 hi(%0:s[0][16:32])
bld.pseudo(aco_opcode::p_unit_test, Operand::zero());
bld.pseudo(aco_opcode::p_extract_vector, Definition(PhysReg(256), v2b), Operand(PhysReg(0), s1),
Operand::c32(1));
//! s_sendmsg sendmsg(dealloc_vgprs)
//! s_endpgm
finish_to_hw_instr_test();
for (aco_ptr<Instruction>& instr : program->blocks[0].instructions) {
if (instr->opcode == aco_opcode::v_mov_b16 && instr->format != asVOP3(Format::VOP1)) {
fail_test("v_mov_b16 must be be VOP3");
return;
}
}
END_TEST