[llvm] [C API] Support uinc_wrap/udec_wrap in atomicrmw when accessing the bin op (PR #87163)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 30 10:01:42 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0fda758f26c1ec06809fdc067cd65dc146f867d0 cd317c8efd821217f5e9ceb37b12879241aaad4b -- llvm/include/llvm-c/Core.h llvm/lib/IR/Core.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index db9322dd81..1871bfca6a 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -361,39 +361,39 @@ typedef enum {
} LLVMAtomicOrdering;
typedef enum {
- LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
- LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
- LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
- LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
- LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
- LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
- LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
- LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
- original using a signed comparison and return
- the old one */
- LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
- original using a signed comparison and return
- the old one */
- LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
- original using an unsigned comparison and return
- the old one */
- LLVMAtomicRMWBinOpUMin, /**< Sets the value if it's greater than the
- original using an unsigned comparison and return
- the old one */
- LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the
- old one */
- LLVMAtomicRMWBinOpFSub, /**< Subtract a floating point value and return the
+ LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
+ LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
+ LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
+ LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
+ LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
+ LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
+ LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
+ LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
+ original using a signed comparison and return
+ the old one */
+ LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
+ original using a signed comparison and return
+ the old one */
+ LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
+ original using an unsigned comparison and return
+ the old one */
+ LLVMAtomicRMWBinOpUMin, /**< Sets the value if it's greater than the
+ original using an unsigned comparison and return
+ the old one */
+ LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the
old one */
- LLVMAtomicRMWBinOpFMax, /**< Sets the value if it's greater than the
- original using an floating point comparison and
- return the old one */
- LLVMAtomicRMWBinOpFMin, /**< Sets the value if it's smaller than the
- original using an floating point comparison and
- return the old one */
- LLVMAtomicRMWBinOpUIncWrap, /**< Increments the value, wrapping back to zero
- when incremented above input value */
- LLVMAtomicRMWBinOpUDecWrap, /**< Decrements the value, wrapping back to
- the input value when decremented below zero */
+ LLVMAtomicRMWBinOpFSub, /**< Subtract a floating point value and return the
+ old one */
+ LLVMAtomicRMWBinOpFMax, /**< Sets the value if it's greater than the
+ original using an floating point comparison and
+ return the old one */
+ LLVMAtomicRMWBinOpFMin, /**< Sets the value if it's smaller than the
+ original using an floating point comparison and
+ return the old one */
+ LLVMAtomicRMWBinOpUIncWrap, /**< Increments the value, wrapping back to zero
+ when incremented above input value */
+ LLVMAtomicRMWBinOpUDecWrap, /**< Decrements the value, wrapping back to
+ the input value when decremented below zero */
} LLVMAtomicRMWBinOp;
typedef enum {
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 9d72e9c4df..6c2fe2cbd8 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -3755,8 +3755,10 @@ static AtomicRMWInst::BinOp mapFromLLVMRMWBinOp(LLVMAtomicRMWBinOp BinOp) {
case LLVMAtomicRMWBinOpFSub: return AtomicRMWInst::FSub;
case LLVMAtomicRMWBinOpFMax: return AtomicRMWInst::FMax;
case LLVMAtomicRMWBinOpFMin: return AtomicRMWInst::FMin;
- case LLVMAtomicRMWBinOpUIncWrap: return AtomicRMWInst::UIncWrap;
- case LLVMAtomicRMWBinOpUDecWrap: return AtomicRMWInst::UDecWrap;
+ case LLVMAtomicRMWBinOpUIncWrap:
+ return AtomicRMWInst::UIncWrap;
+ case LLVMAtomicRMWBinOpUDecWrap:
+ return AtomicRMWInst::UDecWrap;
}
llvm_unreachable("Invalid LLVMAtomicRMWBinOp value!");
@@ -3779,8 +3781,10 @@ static LLVMAtomicRMWBinOp mapToLLVMRMWBinOp(AtomicRMWInst::BinOp BinOp) {
case AtomicRMWInst::FSub: return LLVMAtomicRMWBinOpFSub;
case AtomicRMWInst::FMax: return LLVMAtomicRMWBinOpFMax;
case AtomicRMWInst::FMin: return LLVMAtomicRMWBinOpFMin;
- case AtomicRMWInst::UIncWrap: return LLVMAtomicRMWBinOpUIncWrap;
- case AtomicRMWInst::UDecWrap: return LLVMAtomicRMWBinOpUDecWrap;
+ case AtomicRMWInst::UIncWrap:
+ return LLVMAtomicRMWBinOpUIncWrap;
+ case AtomicRMWInst::UDecWrap:
+ return LLVMAtomicRMWBinOpUDecWrap;
default: break;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/87163
More information about the llvm-commits
mailing list