From ae744745092177c7eaee638bd3962ec7f3677ca8 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 2 May 2022 13:10:47 +0100 Subject: [PATCH] aco: fix propagate_constants_vop3p with integer vop3p and 16-bit constants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This would have created a 1.0.xx operand from 0x3c00.xx or 0x3c003c00.xy for vop3p instructions which have 32-bit operands. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 26cb5caf121..b844de24b83 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -914,8 +914,11 @@ propagate_constants_vop3p(opt_ctx& ctx, aco_ptr& instr, ssa_info& i /* try to fold inline constants */ VOP3P_instruction* vop3p = &instr->vop3p(); - Operand const_lo = Operand::c16(info.val); - Operand const_hi = Operand::c16(info.val >> 16); + /* TODO: if bits==32, we might be able to get an inline constant if we sign-extend or shift left + * 16 bits. + */ + Operand const_lo = Operand::get_const(ctx.program->gfx_level, info.val & 0xffff, bits / 8u); + Operand const_hi = Operand::get_const(ctx.program->gfx_level, info.val >> 16, bits / 8u); bool opsel_lo = (vop3p->opsel_lo >> i) & 1; bool opsel_hi = (vop3p->opsel_hi >> i) & 1;