ac: fix nir_intrinsic_shared_atomic_comp_swap handling
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 1 Mar 2018 09:17:38 +0000 (20:17 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 1 Mar 2018 22:11:20 +0000 (09:11 +1100)
Following on from 49879f377870 this makes sure we use the correct
src index.

Fixes cts test:
KHR-GL46.compute_shader.atomic-case3

Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index afe17a8f11d5d43d0f414a6c389106bd6f617ecc..0ffcd75c3ac6028a7064b841a62670f9ed3f75be 100644 (file)
@@ -3998,7 +3998,7 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx,
 
        if (instr->intrinsic == nir_intrinsic_var_atomic_comp_swap ||
            instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap) {
-               LLVMValueRef src1 = get_src(ctx, instr->src[1]);
+               LLVMValueRef src1 = get_src(ctx, instr->src[src_idx + 1]);
                result = LLVMBuildAtomicCmpXchg(ctx->ac.builder,
                                                ptr, src, src1,
                                                LLVMAtomicOrderingSequentiallyConsistent,