ac/llvm: remove the -1 hack from ac_atomic_inc_wrap
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 19 Jun 2020 16:33:32 +0000 (18:33 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 9 Jul 2020 07:58:01 +0000 (09:58 +0200)
To match the behavior of proprietary drivers.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5688>

src/amd/llvm/ac_nir_to_llvm.c

index bd3cc246e5cd7c496f3d0af23a44bf6b17aaf011..862ae5c30ff9410b25134b755ed743712564c513 100644 (file)
@@ -3032,16 +3032,6 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx,
        case nir_intrinsic_image_deref_atomic_inc_wrap: {
                atomic_name = "inc";
                atomic_subop = ac_atomic_inc_wrap;
-               /* ATOMIC_INC instruction does:
-                *      value = (value + 1) % (data + 1)
-                * but we want:
-                *      value = (value + 1) % data
-                * So replace 'data' by 'data - 1'.
-                */
-               ctx->ssa_defs[instr->src[3].ssa->index] =
-                       LLVMBuildSub(ctx->ac.builder,
-                                    ctx->ssa_defs[instr->src[3].ssa->index],
-                                    ctx->ac.i32_1, "");
                break;
        }
        case nir_intrinsic_bindless_image_atomic_dec_wrap: