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

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 09:44:44 PDT 2020


JonChesterfield added a comment.

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.


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