Mesa (main): aco: fix propagate_constants_vop3p with integer vop3p and 16-bit constants
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 5 17:01:39 UTC 2022
Module: Mesa
Branch: main
Commit: ae744745092177c7eaee638bd3962ec7f3677ca8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae744745092177c7eaee638bd3962ec7f3677ca8
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Mon May 2 13:10:47 2022 +0100
aco: fix propagate_constants_vop3p with integer vop3p and 16-bit constants
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 <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16296>
---
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<Instruction>& 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;
More information about the mesa-commit
mailing list