diff options
author | Rhys Perry <[email protected]> | 2019-11-27 16:49:33 +0000 |
---|---|---|
committer | Rhys Perry <[email protected]> | 2019-12-02 10:48:18 +0000 |
commit | e61a826f39628d87a5ce534d687133ab768c1917 (patch) | |
tree | 1a4fb74ada1435b1d849797628775cabbd85fe29 | |
parent | 1d416ffd095e3e22add0a3665fc8810d310f7077 (diff) |
ac/llvm: fix pointer type for global atomics
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r-- | src/amd/llvm/ac_nir_to_llvm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index db3ed1436b7..ddf9f09fe0c 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -3022,6 +3022,12 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, const char *sync_scope = LLVM_VERSION_MAJOR >= 9 ? "workgroup-one-as" : "workgroup"; + nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr); + if (deref->mode == nir_var_mem_global) { + LLVMTypeRef ptr_type = LLVMPointerType(LLVMTypeOf(src), LLVMGetPointerAddressSpace(LLVMTypeOf(ptr))); + ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type , ""); + } + if (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]); |