diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-04-25 18:22:02 +0200 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:54:00 -0700 |
commit | d00e7d42f5a6bad04c60e399c7ca0b062d3b5dea (patch) | |
tree | 24c9e178eb62cd937c1c510a40017e0e13879ee3 /src/amd | |
parent | 302884d121263455f460a0dc5f433689b8e1a32a (diff) |
ac/nir: Add shared atomic deref instr support.
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 467d1dd19ab..8aee933b2d8 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2806,7 +2806,8 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, 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) { + instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap || + instr->intrinsic == nir_intrinsic_deref_atomic_comp_swap) { LLVMValueRef src1 = get_src(ctx, instr->src[src_idx + 1]); result = LLVMBuildAtomicCmpXchg(ctx->ac.builder, ptr, src, src1, @@ -2819,38 +2820,47 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, switch (instr->intrinsic) { case nir_intrinsic_var_atomic_add: case nir_intrinsic_shared_atomic_add: + case nir_intrinsic_deref_atomic_add: op = LLVMAtomicRMWBinOpAdd; break; case nir_intrinsic_var_atomic_umin: case nir_intrinsic_shared_atomic_umin: + case nir_intrinsic_deref_atomic_umin: op = LLVMAtomicRMWBinOpUMin; break; case nir_intrinsic_var_atomic_umax: case nir_intrinsic_shared_atomic_umax: + case nir_intrinsic_deref_atomic_umax: op = LLVMAtomicRMWBinOpUMax; break; case nir_intrinsic_var_atomic_imin: case nir_intrinsic_shared_atomic_imin: + case nir_intrinsic_deref_atomic_imin: op = LLVMAtomicRMWBinOpMin; break; case nir_intrinsic_var_atomic_imax: case nir_intrinsic_shared_atomic_imax: + case nir_intrinsic_deref_atomic_imax: op = LLVMAtomicRMWBinOpMax; break; case nir_intrinsic_var_atomic_and: case nir_intrinsic_shared_atomic_and: + case nir_intrinsic_deref_atomic_and: op = LLVMAtomicRMWBinOpAnd; break; case nir_intrinsic_var_atomic_or: case nir_intrinsic_shared_atomic_or: + case nir_intrinsic_deref_atomic_or: op = LLVMAtomicRMWBinOpOr; break; case nir_intrinsic_var_atomic_xor: case nir_intrinsic_shared_atomic_xor: + case nir_intrinsic_deref_atomic_xor: op = LLVMAtomicRMWBinOpXor; break; case nir_intrinsic_var_atomic_exchange: case nir_intrinsic_shared_atomic_exchange: + case nir_intrinsic_deref_atomic_exchange: op = LLVMAtomicRMWBinOpXchg; break; default: @@ -3233,6 +3243,20 @@ static void visit_intrinsic(struct ac_nir_context *ctx, result = visit_var_atomic(ctx, instr, ptr, 0); break; } + case nir_intrinsic_deref_atomic_add: + case nir_intrinsic_deref_atomic_imin: + case nir_intrinsic_deref_atomic_umin: + case nir_intrinsic_deref_atomic_imax: + case nir_intrinsic_deref_atomic_umax: + case nir_intrinsic_deref_atomic_and: + case nir_intrinsic_deref_atomic_or: + case nir_intrinsic_deref_atomic_xor: + case nir_intrinsic_deref_atomic_exchange: + case nir_intrinsic_deref_atomic_comp_swap: { + LLVMValueRef ptr = get_src(ctx, instr->src[0]); + result = visit_var_atomic(ctx, instr, ptr, 1); + break; + } case nir_intrinsic_interp_var_at_centroid: case nir_intrinsic_interp_var_at_sample: case nir_intrinsic_interp_var_at_offset: |