radeonsi: fix the coordinate overloading of llvm.amdgcn.image.atomic.cmpswap.*
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 10 Oct 2016 13:09:40 +0000 (15:09 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 13 Oct 2016 08:17:42 +0000 (10:17 +0200)
Fixes GL45-CTS.shader_image_load_store.basic-allTargets-atomic*

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c

index 8b77fd1c9f2f17d25c66d9e49fc88fb429ba4b5a..25146e8d43fce3b7551a286a0d27764d14473f8b 100644 (file)
@@ -4195,10 +4195,15 @@ static void atomic_emit(
                snprintf(intrinsic_name, sizeof(intrinsic_name),
                         "llvm.amdgcn.buffer.atomic.%s", action->intr_name);
        } else {
+               LLVMValueRef coords;
                char coords_type[8];
 
-               build_type_name_for_intr(LLVMTypeOf(emit_data->args[1]),
-                                   coords_type, sizeof(coords_type));
+               if (inst->Instruction.Opcode == TGSI_OPCODE_ATOMCAS)
+                       coords = emit_data->args[2];
+               else
+                       coords = emit_data->args[1];
+
+               build_type_name_for_intr(coords, coords_type, sizeof(coords_type));
                snprintf(intrinsic_name, sizeof(intrinsic_name),
                         "llvm.amdgcn.image.atomic.%s.%s",
                         action->intr_name, coords_type);