[PATCH] D80804: [AMDGPU] Introduce Clang builtins to be mapped to AMDGCN atomic inc/dec intrinsics

Saiyedul Islam via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 03:12:23 PDT 2020


saiislam added a comment.

In D80804#2123183 <https://reviews.llvm.org/D80804#2123183>, @JonChesterfield wrote:

> This patch declares the clang builtin as acting on signed values, but the IR intrinsic maps to an instruction which does an unsigned comparison. We don't have ISA support for a signed comparison equivalent. Addition is the same operation on signed or unsigned integers, but signed integer comparison is not equivalent to unsigned integer comparison.
>
>   // 32bit
>    tmp = MEM[ADDR];
>    MEM[ADDR] = (tmp >= DATA) ? 0 : tmp + 1; // unsigned
>   compare
>    RETURN_DATA = tmp.
>
>
> The builtins should be changed to take unsigned values, optionally making that clear from the naming scheme, perhaps  `__amdgcn_builtin_atomic_dec_u32`.
>
> Apologies for not reviewing this the first time around.


I have created D83121 <https://reviews.llvm.org/D83121> for this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80804/new/

https://reviews.llvm.org/D80804





More information about the cfe-commits mailing list