mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 08:10:14 +01:00
ac/llvm: fix umul_high
LLVM optimizes umul_hi with a constant to v_mul_hi_i32_i24_e32 which isn't always what we need here. This causes miscalculations. To prevent LLVM to apply this optimization, we insert a optimization barrier. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11761 Suggested-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30810>
This commit is contained in:
parent
2162cf7476
commit
74dafa3c79
1 changed files with 8 additions and 0 deletions
|
|
@ -333,6 +333,14 @@ static LLVMValueRef emit_umul_high(struct ac_llvm_context *ctx, LLVMValueRef src
|
|||
LLVMValueRef src1)
|
||||
{
|
||||
LLVMValueRef dst64, result;
|
||||
|
||||
#if LLVM_VERSION_MAJOR < 20
|
||||
if (LLVMIsConstant(src0))
|
||||
ac_build_optimization_barrier(ctx, &src1, false);
|
||||
else
|
||||
ac_build_optimization_barrier(ctx, &src0, false);
|
||||
#endif
|
||||
|
||||
src0 = LLVMBuildZExt(ctx->builder, src0, ctx->i64, "");
|
||||
src1 = LLVMBuildZExt(ctx->builder, src1, ctx->i64, "");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue