mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-23 11:43:32 +00:00
[OMPIRBuilder] Remove the support for floating point values for atomic compare operation
This patch removes the type punning in atomic compare operation for floating point values because the direct comparison doesn't make too much sense for floating point values. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D119378
This commit is contained in:
parent
8c930cef0e
commit
0148b58714
@ -3481,26 +3481,16 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createAtomicCompare(
|
||||
|
||||
assert(X.Var->getType()->isPointerTy() &&
|
||||
"OMP atomic expects a pointer to target memory");
|
||||
assert((X.ElemTy->isFloatingPointTy() || X.ElemTy->isIntegerTy() ||
|
||||
X.ElemTy->isPointerTy()) &&
|
||||
"OMP atomic compare expected a scalar type");
|
||||
assert((X.ElemTy->isIntegerTy() || X.ElemTy->isPointerTy()) &&
|
||||
"OMP atomic compare expected a integer scalar type");
|
||||
|
||||
if (Op == OMPAtomicCompareOp::EQ) {
|
||||
unsigned Addrspace = cast<PointerType>(X.Var->getType())->getAddressSpace();
|
||||
IntegerType *IntCastTy =
|
||||
IntegerType::get(M.getContext(), X.ElemTy->getScalarSizeInBits());
|
||||
Value *XAddr =
|
||||
X.ElemTy->isIntegerTy()
|
||||
? X.Var
|
||||
: Builder.CreateBitCast(X.Var, IntCastTy->getPointerTo(Addrspace));
|
||||
AtomicOrdering Failure = AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
|
||||
// We don't need the result for now.
|
||||
(void)Builder.CreateAtomicCmpXchg(XAddr, E, D, MaybeAlign(), AO, Failure);
|
||||
(void)Builder.CreateAtomicCmpXchg(X.Var, E, D, MaybeAlign(), AO, Failure);
|
||||
} else {
|
||||
assert((Op == OMPAtomicCompareOp::MAX || Op == OMPAtomicCompareOp::MIN) &&
|
||||
"Op should be either max or min at this point");
|
||||
assert(X.ElemTy->isIntegerTy() &&
|
||||
"max and min operators only support integer type");
|
||||
|
||||
// Reverse the ordop as the OpenMP forms are different from LLVM forms.
|
||||
// Let's take max as example.
|
||||
|
Loading…
x
Reference in New Issue
Block a user