[Mesa-stable] [PATCH] ac/nir: generate correct instruction for atomic min/max on unsigned images

Alex Smith asmith at feralinteractive.com
Wed Oct 25 10:35:36 UTC 2017


Forgot to add

Cc: "17.2 17.3" <mesa-stable at lists.freedesktop.org>

On 25 October 2017 at 11:24, Matthew Nicholls <
mnicholls at feralinteractive.com> wrote:

> ---
>  src/amd/common/ac_nir_to_llvm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_
> llvm.c
> index 3d635d4206..870731f3eb 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -3667,15 +3667,17 @@ static LLVMValueRef visit_image_atomic(struct
> ac_nir_context *ctx,
>         LLVMValueRef i1true = LLVMConstInt(ctx->ac.i1, 1, false);
>         MAYBE_UNUSED int length;
>
> +       bool is_unsigned = glsl_get_sampler_result_type(type) ==
> GLSL_TYPE_UINT;
> +
>         switch (instr->intrinsic) {
>         case nir_intrinsic_image_atomic_add:
>                 atomic_name = "add";
>                 break;
>         case nir_intrinsic_image_atomic_min:
> -               atomic_name = "smin";
> +               atomic_name = is_unsigned ? "umin" : "smin";
>                 break;
>         case nir_intrinsic_image_atomic_max:
> -               atomic_name = "smax";
> +               atomic_name = is_unsigned ? "umin" : "smax";
>                 break;
>         case nir_intrinsic_image_atomic_and:
>                 atomic_name = "and";
> --
> 2.13.6
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20171025/575528ce/attachment.html>


More information about the mesa-stable mailing list