IR: Add atomicrmw uinc_wrap and udec_wrap
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 3 Nov 2022 01:50:48 +0000 (18:50 -0700)
committerMatt Arsenault <arsenm2@gmail.com>
Tue, 24 Jan 2023 21:55:11 +0000 (17:55 -0400)
commit778cf5431cafc243f81dd5c8cbd27701ff7f9120
tree1a1c63468df1436efd906da8f33afcb033e77e2a
parente44a305690add9f759d2fba85827bca260c94b41
IR: Add atomicrmw uinc_wrap and udec_wrap

These are essentially add/sub 1 with a clamping value.

AMDGPU has instructions for these. CUDA/HIP expose these as
atomicInc/atomicDec. Currently we use target intrinsics for these,
but those do no carry the ordering and syncscope. Add these to
atomicrmw so we can carry these and benefit from the regular
legalization processes.
44 files changed:
llvm/docs/LangRef.rst
llvm/docs/ReleaseNotes.rst
llvm/include/llvm/AsmParser/LLToken.h
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/include/llvm/CodeGen/ISDOpcodes.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/include/llvm/IR/Instructions.h
llvm/include/llvm/Support/TargetOpcodes.def
llvm/include/llvm/Target/GenericOpcodes.td
llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
llvm/include/llvm/Target/TargetSelectionDAG.td
llvm/include/llvm/Transforms/Utils/LowerAtomic.h
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AtomicExpandPass.cpp
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/IR/Instructions.cpp
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Transforms/Utils/LowerAtomic.cpp
llvm/test/Assembler/atomic.ll
llvm/test/Bitcode/compatibility.ll
llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
llvm/test/CodeGen/AArch64/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/private-memory-atomics.ll
llvm/test/CodeGen/ARM/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/Hexagon/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/LoongArch/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/SPARC/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/VE/Scalar/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/WebAssembly/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/atomicrmw-uinc-udec-wrap.ll [new file with mode: 0644]
llvm/test/Transforms/AtomicExpand/AMDGPU/expand-atomic-i16.ll
llvm/test/Transforms/AtomicExpand/AMDGPU/expand-atomic-i8.ll