[all-commits] [llvm/llvm-project] e58e30: [NVPTX][clang] Remove nvvm scoped atomic intrinsic...

Justin Lebar via All-commits all-commits at lists.llvm.org
Mon Jun 1 15:19:18 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e58e30842fdbae26153757985de2d5fecc7a174e
      https://github.com/llvm/llvm-project/commit/e58e30842fdbae26153757985de2d5fecc7a174e
  Author: Justin Lebar <justin.lebar at gmail.com>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    M clang/lib/CodeGen/TargetBuiltins/NVPTX.cpp
    M clang/test/CodeGen/builtins-nvptx.c
    M llvm/include/llvm/IR/IntrinsicsNVVM.td
    M llvm/lib/IR/AutoUpgrade.cpp
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
    M llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
    M llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
    M llvm/test/Assembler/auto_upgrade_nvvm_intrinsics.ll
    M llvm/test/CodeGen/NVPTX/atomicrmw-sm60.ll
    M llvm/test/CodeGen/NVPTX/atomicrmw-sm70.ll
    M llvm/test/CodeGen/NVPTX/atomicrmw-sm90.ll
    M llvm/test/CodeGen/NVPTX/atomicrmw.py
    R llvm/test/CodeGen/NVPTX/atomics-with-scope.ll

  Log Message:
  -----------
  [NVPTX][clang] Remove nvvm scoped atomic intrinsics; use atomicrmw/cmpxchg (#200735)

The
`llvm.nvvm.atomic.{add,exch,max,min,inc,dec,and,or,xor,cas}.gen.{i,f}.{cta,sys}`
intrinsics are redundant; we can use atomicrmw / cmpxchg with a syncscope.

Moreover, the nvvm atomics are problematic because they don't have
unsigned min/max opcodes. Clang uses these intrinsics and currently emits
signed min/max for what should be unsigned operations!

Fix by doing the following.

 - Remove the nvvm intrinsics.
 - Auto-upgrade the removed intrinsics to atomicrmw/cmpxchg.
 - Make clang Clang emits atomicrmw/cmpxchg directly.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list