mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-19 15:32:24 +01:00
ac/nir: fix nir_intrinsic_shared_atomic_fadd
This was completely broken. Fixes dEQP-VK.glsl.atomic_operations.add_float32_compute_shared. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6936>
This commit is contained in:
parent
8227b08c08
commit
b00a023f1e
2 changed files with 14 additions and 0 deletions
|
|
@ -309,6 +309,11 @@ LLVMValueRef ac_build_atomic_rmw(struct ac_llvm_context *ctx, LLVMAtomicRMWBinOp
|
|||
case LLVMAtomicRMWBinOpUMin:
|
||||
binop = llvm::AtomicRMWInst::UMin;
|
||||
break;
|
||||
#if LLVM_VERSION_MAJOR >= 10
|
||||
case LLVMAtomicRMWBinOpFAdd:
|
||||
binop = llvm::AtomicRMWInst::FAdd;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
unreachable("invalid LLVMAtomicRMWBinOp");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3364,11 +3364,20 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, const nir_intri
|
|||
if (instr->intrinsic == nir_intrinsic_shared_atomic_fadd ||
|
||||
instr->intrinsic == nir_intrinsic_deref_atomic_fadd) {
|
||||
val = ac_to_float(&ctx->ac, src);
|
||||
|
||||
LLVMTypeRef ptr_type =
|
||||
LLVMPointerType(LLVMTypeOf(val), LLVMGetPointerAddressSpace(LLVMTypeOf(ptr)));
|
||||
ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type, "");
|
||||
} else {
|
||||
val = ac_to_integer(&ctx->ac, src);
|
||||
}
|
||||
|
||||
result = ac_build_atomic_rmw(&ctx->ac, op, ptr, val, sync_scope);
|
||||
|
||||
if (instr->intrinsic == nir_intrinsic_shared_atomic_fadd ||
|
||||
instr->intrinsic == nir_intrinsic_deref_atomic_fadd) {
|
||||
result = ac_to_integer(&ctx->ac, result);
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->ac.postponed_kill)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue