From: Dave Airlie Date: Wed, 28 Feb 2018 23:38:19 +0000 (+1000) Subject: ac/nir: fix shared atomic operations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=49879f377870;p=mesa.git ac/nir: fix shared atomic operations. The nir->llvm conversion was using the wrong srcs. Fixes: tests/spec/arb_compute_shader/execution/shared-atomics.shader_test Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Timothy Arceri Signed-off-by: Dave Airlie --- diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 3c5be7e2036..afe17a8f11d 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3991,10 +3991,10 @@ visit_store_shared(struct ac_nir_context *ctx, static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, const nir_intrinsic_instr *instr, - LLVMValueRef ptr) + LLVMValueRef ptr, int src_idx) { LLVMValueRef result; - LLVMValueRef src = get_src(ctx, instr->src[0]); + LLVMValueRef src = get_src(ctx, instr->src[src_idx]); if (instr->intrinsic == nir_intrinsic_var_atomic_comp_swap || instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap) { @@ -4574,8 +4574,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx, case nir_intrinsic_shared_atomic_xor: case nir_intrinsic_shared_atomic_exchange: case nir_intrinsic_shared_atomic_comp_swap: { - LLVMValueRef ptr = get_memory_ptr(ctx, instr->src[1]); - result = visit_var_atomic(ctx, instr, ptr); + LLVMValueRef ptr = get_memory_ptr(ctx, instr->src[0]); + result = visit_var_atomic(ctx, instr, ptr, 1); break; } case nir_intrinsic_var_atomic_add: @@ -4589,7 +4589,7 @@ static void visit_intrinsic(struct ac_nir_context *ctx, case nir_intrinsic_var_atomic_exchange: case nir_intrinsic_var_atomic_comp_swap: { LLVMValueRef ptr = build_gep_for_deref(ctx, instr->variables[0]); - result = visit_var_atomic(ctx, instr, ptr); + result = visit_var_atomic(ctx, instr, ptr, 0); break; } case nir_intrinsic_interp_var_at_centroid: