Skip to content

Commit

Permalink
Merge pull request #526 from hvdijk/llvm20-usubcondsat
Browse files Browse the repository at this point in the history
[LLVM20] Handle USubCond, USubSat.
  • Loading branch information
hvdijk authored Sep 9, 2024
2 parents 9e76dd1 + c5f855f commit 4acf063
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/compiler/vecz/source/vectorization_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <llvm/IR/Instructions.h>
#include <llvm/Support/AtomicOrdering.h>
#include <llvm/Target/TargetMachine.h>
#include <multi_llvm/multi_llvm.h>
#include <multi_llvm/vector_type_helper.h>

#include <algorithm>
Expand Down Expand Up @@ -444,6 +445,12 @@ VectorizationContext::isMaskedAtomicFunction(const Function &F) const {
AtomicInfo.BinOp = AtomicRMWInst::BinOp::UIncWrap;
} else if (FnName.consume_front("udecwrap")) {
AtomicInfo.BinOp = AtomicRMWInst::BinOp::UDecWrap;
#if LLVM_VERSION_GREATER_EQUAL(20, 0)
} else if (FnName.consume_front("usubcond")) {
AtomicInfo.BinOp = AtomicRMWInst::BinOp::USubCond;
} else if (FnName.consume_front("usubsat")) {
AtomicInfo.BinOp = AtomicRMWInst::BinOp::USubSat;
#endif
} else {
return std::nullopt;
}
Expand Down Expand Up @@ -583,6 +590,10 @@ Function *VectorizationContext::getOrCreateMaskedAtomicFunction(
BINOP_CASE(FMin, "fmin");
BINOP_CASE(UIncWrap, "uincwrap");
BINOP_CASE(UDecWrap, "udecwrap");
#if LLVM_VERSION_GREATER_EQUAL(20, 0)
BINOP_CASE(USubCond, "usubcond");
BINOP_CASE(USubSat, "usubsat");
#endif
case llvm::AtomicRMWInst::BAD_BINOP:
return nullptr;
}
Expand Down

0 comments on commit 4acf063

Please sign in to comment.