forked from OSchip/llvm-project
[OPENMP] Fixed bug in atomic update/capture/write constructs.
Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes. llvm-svn: 237422
This commit is contained in:
parent
cdad63b33d
commit
f0ab553fea
|
@ -215,6 +215,17 @@ namespace {
|
|||
llvm::AtomicOrdering Failure = llvm::SequentiallyConsistent,
|
||||
bool IsWeak = false);
|
||||
|
||||
/// \brief Emits atomic update.
|
||||
/// \brief AO Atomic ordering.
|
||||
/// \brief UpdateOp Update operation for the current lvalue.
|
||||
void EmitAtomicUpdate(llvm::AtomicOrdering AO,
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile);
|
||||
/// \brief Emits atomic update.
|
||||
/// \brief AO Atomic ordering.
|
||||
void EmitAtomicUpdate(llvm::AtomicOrdering AO, RValue UpdateRVal,
|
||||
bool IsVolatile);
|
||||
|
||||
/// Materialize an atomic r-value in atomic-layout memory.
|
||||
llvm::Value *materializeRValue(RValue rvalue) const;
|
||||
|
||||
|
@ -235,16 +246,31 @@ namespace {
|
|||
/// \brief Emits atomic load as LLVM instruction.
|
||||
llvm::Value *EmitAtomicLoadOp(llvm::AtomicOrdering AO, bool IsVolatile);
|
||||
/// \brief Emits atomic compare-and-exchange op as a libcall.
|
||||
std::pair<RValue, llvm::Value *> EmitAtomicCompareExchangeLibcall(
|
||||
RValue Expected, RValue DesiredAddr,
|
||||
llvm::Value *EmitAtomicCompareExchangeLibcall(
|
||||
llvm::Value *ExpectedAddr, llvm::Value *DesiredAddr,
|
||||
llvm::AtomicOrdering Success = llvm::SequentiallyConsistent,
|
||||
llvm::AtomicOrdering Failure = llvm::SequentiallyConsistent);
|
||||
/// \brief Emits atomic compare-and-exchange op as LLVM instruction.
|
||||
std::pair<RValue, llvm::Value *> EmitAtomicCompareExchangeOp(
|
||||
RValue Expected, RValue Desired,
|
||||
std::pair<llvm::Value *, llvm::Value *> EmitAtomicCompareExchangeOp(
|
||||
llvm::Value *ExpectedVal, llvm::Value *DesiredVal,
|
||||
llvm::AtomicOrdering Success = llvm::SequentiallyConsistent,
|
||||
llvm::AtomicOrdering Failure = llvm::SequentiallyConsistent,
|
||||
bool IsWeak = false);
|
||||
/// \brief Emit atomic update as libcalls.
|
||||
void
|
||||
EmitAtomicUpdateLibcall(llvm::AtomicOrdering AO,
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile);
|
||||
/// \brief Emit atomic update as LLVM instructions.
|
||||
void EmitAtomicUpdateOp(llvm::AtomicOrdering AO,
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile);
|
||||
/// \brief Emit atomic update as libcalls.
|
||||
void EmitAtomicUpdateLibcall(llvm::AtomicOrdering AO, RValue UpdateRVal,
|
||||
bool IsVolatile);
|
||||
/// \brief Emit atomic update as LLVM instructions.
|
||||
void EmitAtomicUpdateOp(llvm::AtomicOrdering AO, RValue UpdateRal,
|
||||
bool IsVolatile);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1313,12 +1339,10 @@ llvm::Value *AtomicInfo::convertRValueToInt(RValue RVal) const {
|
|||
getAtomicAlignment().getQuantity());
|
||||
}
|
||||
|
||||
std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchangeOp(
|
||||
RValue Expected, RValue Desired, llvm::AtomicOrdering Success,
|
||||
llvm::AtomicOrdering Failure, bool IsWeak) {
|
||||
std::pair<llvm::Value *, llvm::Value *> AtomicInfo::EmitAtomicCompareExchangeOp(
|
||||
llvm::Value *ExpectedVal, llvm::Value *DesiredVal,
|
||||
llvm::AtomicOrdering Success, llvm::AtomicOrdering Failure, bool IsWeak) {
|
||||
// Do the atomic store.
|
||||
auto *ExpectedVal = convertRValueToInt(Expected);
|
||||
auto *DesiredVal = convertRValueToInt(Desired);
|
||||
auto *Addr = emitCastToAtomicIntPointer(getAtomicAddress());
|
||||
auto *Inst = CGF.Builder.CreateAtomicCmpXchg(Addr, ExpectedVal, DesiredVal,
|
||||
Success, Failure);
|
||||
|
@ -1329,20 +1353,16 @@ std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchangeOp(
|
|||
// Okay, turn that back into the original value type.
|
||||
auto *PreviousVal = CGF.Builder.CreateExtractValue(Inst, /*Idxs=*/0);
|
||||
auto *SuccessFailureVal = CGF.Builder.CreateExtractValue(Inst, /*Idxs=*/1);
|
||||
return std::make_pair(
|
||||
ConvertIntToValueOrAtomic(PreviousVal, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false),
|
||||
SuccessFailureVal);
|
||||
return std::make_pair(PreviousVal, SuccessFailureVal);
|
||||
}
|
||||
|
||||
std::pair<RValue, llvm::Value *>
|
||||
AtomicInfo::EmitAtomicCompareExchangeLibcall(RValue Expected, RValue Desired,
|
||||
llvm::Value *
|
||||
AtomicInfo::EmitAtomicCompareExchangeLibcall(llvm::Value *ExpectedAddr,
|
||||
llvm::Value *DesiredAddr,
|
||||
llvm::AtomicOrdering Success,
|
||||
llvm::AtomicOrdering Failure) {
|
||||
// bool __atomic_compare_exchange(size_t size, void *obj, void *expected,
|
||||
// void *desired, int success, int failure);
|
||||
auto *ExpectedAddr = materializeRValue(Expected);
|
||||
auto *DesiredAddr = materializeRValue(Desired);
|
||||
CallArgList Args;
|
||||
Args.add(RValue::get(getAtomicSizeValue()), CGF.getContext().getSizeType());
|
||||
Args.add(RValue::get(CGF.EmitCastToVoidPtr(getAtomicAddress())),
|
||||
|
@ -1360,10 +1380,7 @@ AtomicInfo::EmitAtomicCompareExchangeLibcall(RValue Expected, RValue Desired,
|
|||
auto SuccessFailureRVal = emitAtomicLibcall(CGF, "__atomic_compare_exchange",
|
||||
CGF.getContext().BoolTy, Args);
|
||||
|
||||
return std::make_pair(
|
||||
convertTempToRValue(ExpectedAddr, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false),
|
||||
SuccessFailureRVal.getScalarVal());
|
||||
return SuccessFailureRVal.getScalarVal();
|
||||
}
|
||||
|
||||
std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchange(
|
||||
|
@ -1376,14 +1393,247 @@ std::pair<RValue, llvm::Value *> AtomicInfo::EmitAtomicCompareExchange(
|
|||
// Check whether we should use a library call.
|
||||
if (shouldUseLibcall()) {
|
||||
// Produce a source address.
|
||||
return EmitAtomicCompareExchangeLibcall(Expected, Desired, Success,
|
||||
Failure);
|
||||
auto *ExpectedAddr = materializeRValue(Expected);
|
||||
auto *DesiredAddr = materializeRValue(Desired);
|
||||
auto *Res = EmitAtomicCompareExchangeLibcall(ExpectedAddr, DesiredAddr,
|
||||
Success, Failure);
|
||||
return std::make_pair(
|
||||
convertTempToRValue(ExpectedAddr, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false),
|
||||
Res);
|
||||
}
|
||||
|
||||
// If we've got a scalar value of the right size, try to avoid going
|
||||
// through memory.
|
||||
return EmitAtomicCompareExchangeOp(Expected, Desired, Success, Failure,
|
||||
IsWeak);
|
||||
auto *ExpectedVal = convertRValueToInt(Expected);
|
||||
auto *DesiredVal = convertRValueToInt(Desired);
|
||||
auto Res = EmitAtomicCompareExchangeOp(ExpectedVal, DesiredVal, Success,
|
||||
Failure, IsWeak);
|
||||
return std::make_pair(
|
||||
ConvertIntToValueOrAtomic(Res.first, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false),
|
||||
Res.second);
|
||||
}
|
||||
|
||||
static void
|
||||
EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics, RValue OldRVal,
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
llvm::Value *DesiredAddr) {
|
||||
llvm::Value *Ptr = nullptr;
|
||||
LValue UpdateLVal;
|
||||
RValue UpRVal;
|
||||
LValue AtomicLVal = Atomics.getAtomicLValue();
|
||||
LValue DesiredLVal;
|
||||
if (AtomicLVal.isSimple()) {
|
||||
UpRVal = OldRVal;
|
||||
DesiredLVal =
|
||||
LValue::MakeAddr(DesiredAddr, AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment(), CGF.CGM.getContext());
|
||||
} else {
|
||||
// Build new lvalue for temp address
|
||||
Ptr = Atomics.materializeRValue(OldRVal);
|
||||
if (AtomicLVal.isBitField()) {
|
||||
UpdateLVal =
|
||||
LValue::MakeBitfield(Ptr, AtomicLVal.getBitFieldInfo(),
|
||||
AtomicLVal.getType(), AtomicLVal.getAlignment());
|
||||
DesiredLVal =
|
||||
LValue::MakeBitfield(DesiredAddr, AtomicLVal.getBitFieldInfo(),
|
||||
AtomicLVal.getType(), AtomicLVal.getAlignment());
|
||||
} else if (AtomicLVal.isVectorElt()) {
|
||||
UpdateLVal = LValue::MakeVectorElt(Ptr, AtomicLVal.getVectorIdx(),
|
||||
AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
DesiredLVal = LValue::MakeVectorElt(
|
||||
DesiredAddr, AtomicLVal.getVectorIdx(), AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
} else {
|
||||
assert(AtomicLVal.isExtVectorElt());
|
||||
UpdateLVal = LValue::MakeExtVectorElt(Ptr, AtomicLVal.getExtVectorElts(),
|
||||
AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
DesiredLVal = LValue::MakeExtVectorElt(
|
||||
DesiredAddr, AtomicLVal.getExtVectorElts(), AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
}
|
||||
UpdateLVal.setTBAAInfo(AtomicLVal.getTBAAInfo());
|
||||
DesiredLVal.setTBAAInfo(AtomicLVal.getTBAAInfo());
|
||||
UpRVal = CGF.EmitLoadOfLValue(UpdateLVal, SourceLocation());
|
||||
}
|
||||
// Store new value in the corresponding memory area
|
||||
RValue NewRVal = UpdateOp(UpRVal);
|
||||
if (NewRVal.isScalar()) {
|
||||
CGF.EmitStoreThroughLValue(NewRVal, DesiredLVal);
|
||||
} else {
|
||||
assert(NewRVal.isComplex());
|
||||
CGF.EmitStoreOfComplex(NewRVal.getComplexVal(), DesiredLVal,
|
||||
/*isInit=*/false);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdateLibcall(
|
||||
llvm::AtomicOrdering AO, const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile) {
|
||||
auto Failure = llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
|
||||
|
||||
llvm::Value *ExpectedAddr = CreateTempAlloca();
|
||||
|
||||
EmitAtomicLoadLibcall(ExpectedAddr, AO, IsVolatile);
|
||||
auto *ContBB = CGF.createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
|
||||
CGF.EmitBlock(ContBB);
|
||||
auto *DesiredAddr = CreateTempAlloca();
|
||||
if ((LVal.isBitField() && BFI.Size != ValueSizeInBits) ||
|
||||
requiresMemSetZero(
|
||||
getAtomicAddress()->getType()->getPointerElementType())) {
|
||||
auto *OldVal = CGF.Builder.CreateAlignedLoad(
|
||||
ExpectedAddr, getAtomicAlignment().getQuantity());
|
||||
CGF.Builder.CreateAlignedStore(OldVal, DesiredAddr,
|
||||
getAtomicAlignment().getQuantity());
|
||||
}
|
||||
auto OldRVal = convertTempToRValue(ExpectedAddr, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false);
|
||||
EmitAtomicUpdateValue(CGF, *this, OldRVal, UpdateOp, DesiredAddr);
|
||||
auto *Res =
|
||||
EmitAtomicCompareExchangeLibcall(ExpectedAddr, DesiredAddr, AO, Failure);
|
||||
CGF.Builder.CreateCondBr(Res, ExitBB, ContBB);
|
||||
CGF.EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdateOp(
|
||||
llvm::AtomicOrdering AO, const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile) {
|
||||
auto Failure = llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
|
||||
|
||||
// Do the atomic load.
|
||||
auto *OldVal = EmitAtomicLoadOp(AO, IsVolatile);
|
||||
// For non-simple lvalues perform compare-and-swap procedure.
|
||||
auto *ContBB = CGF.createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
|
||||
auto *CurBB = CGF.Builder.GetInsertBlock();
|
||||
CGF.EmitBlock(ContBB);
|
||||
llvm::PHINode *PHI = CGF.Builder.CreatePHI(OldVal->getType(),
|
||||
/*NumReservedValues=*/2);
|
||||
PHI->addIncoming(OldVal, CurBB);
|
||||
auto *NewAtomicAddr = CreateTempAlloca();
|
||||
auto *NewAtomicIntAddr = emitCastToAtomicIntPointer(NewAtomicAddr);
|
||||
if ((LVal.isBitField() && BFI.Size != ValueSizeInBits) ||
|
||||
requiresMemSetZero(
|
||||
getAtomicAddress()->getType()->getPointerElementType())) {
|
||||
CGF.Builder.CreateAlignedStore(PHI, NewAtomicIntAddr,
|
||||
getAtomicAlignment().getQuantity());
|
||||
}
|
||||
auto OldRVal = ConvertIntToValueOrAtomic(PHI, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false);
|
||||
EmitAtomicUpdateValue(CGF, *this, OldRVal, UpdateOp, NewAtomicAddr);
|
||||
auto *DesiredVal = CGF.Builder.CreateAlignedLoad(
|
||||
NewAtomicIntAddr, getAtomicAlignment().getQuantity());
|
||||
// Try to write new value using cmpxchg operation
|
||||
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
||||
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
||||
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
||||
CGF.EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
}
|
||||
|
||||
static void EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics,
|
||||
RValue UpdateRVal, llvm::Value *DesiredAddr) {
|
||||
LValue AtomicLVal = Atomics.getAtomicLValue();
|
||||
LValue DesiredLVal;
|
||||
// Build new lvalue for temp address
|
||||
if (AtomicLVal.isBitField()) {
|
||||
DesiredLVal =
|
||||
LValue::MakeBitfield(DesiredAddr, AtomicLVal.getBitFieldInfo(),
|
||||
AtomicLVal.getType(), AtomicLVal.getAlignment());
|
||||
} else if (AtomicLVal.isVectorElt()) {
|
||||
DesiredLVal =
|
||||
LValue::MakeVectorElt(DesiredAddr, AtomicLVal.getVectorIdx(),
|
||||
AtomicLVal.getType(), AtomicLVal.getAlignment());
|
||||
} else {
|
||||
assert(AtomicLVal.isExtVectorElt());
|
||||
DesiredLVal = LValue::MakeExtVectorElt(
|
||||
DesiredAddr, AtomicLVal.getExtVectorElts(), AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
}
|
||||
DesiredLVal.setTBAAInfo(AtomicLVal.getTBAAInfo());
|
||||
// Store new value in the corresponding memory area
|
||||
assert(UpdateRVal.isScalar());
|
||||
CGF.EmitStoreThroughLValue(UpdateRVal, DesiredLVal);
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdateLibcall(llvm::AtomicOrdering AO,
|
||||
RValue UpdateRVal, bool IsVolatile) {
|
||||
auto Failure = llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
|
||||
|
||||
llvm::Value *ExpectedAddr = CreateTempAlloca();
|
||||
|
||||
EmitAtomicLoadLibcall(ExpectedAddr, AO, IsVolatile);
|
||||
auto *ContBB = CGF.createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
|
||||
CGF.EmitBlock(ContBB);
|
||||
auto *DesiredAddr = CreateTempAlloca();
|
||||
if ((LVal.isBitField() && BFI.Size != ValueSizeInBits) ||
|
||||
requiresMemSetZero(
|
||||
getAtomicAddress()->getType()->getPointerElementType())) {
|
||||
auto *OldVal = CGF.Builder.CreateAlignedLoad(
|
||||
ExpectedAddr, getAtomicAlignment().getQuantity());
|
||||
CGF.Builder.CreateAlignedStore(OldVal, DesiredAddr,
|
||||
getAtomicAlignment().getQuantity());
|
||||
}
|
||||
EmitAtomicUpdateValue(CGF, *this, UpdateRVal, DesiredAddr);
|
||||
auto *Res =
|
||||
EmitAtomicCompareExchangeLibcall(ExpectedAddr, DesiredAddr, AO, Failure);
|
||||
CGF.Builder.CreateCondBr(Res, ExitBB, ContBB);
|
||||
CGF.EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdateOp(llvm::AtomicOrdering AO, RValue UpdateRVal,
|
||||
bool IsVolatile) {
|
||||
auto Failure = llvm::AtomicCmpXchgInst::getStrongestFailureOrdering(AO);
|
||||
|
||||
// Do the atomic load.
|
||||
auto *OldVal = EmitAtomicLoadOp(AO, IsVolatile);
|
||||
// For non-simple lvalues perform compare-and-swap procedure.
|
||||
auto *ContBB = CGF.createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = CGF.createBasicBlock("atomic_exit");
|
||||
auto *CurBB = CGF.Builder.GetInsertBlock();
|
||||
CGF.EmitBlock(ContBB);
|
||||
llvm::PHINode *PHI = CGF.Builder.CreatePHI(OldVal->getType(),
|
||||
/*NumReservedValues=*/2);
|
||||
PHI->addIncoming(OldVal, CurBB);
|
||||
auto *NewAtomicAddr = CreateTempAlloca();
|
||||
auto *NewAtomicIntAddr = emitCastToAtomicIntPointer(NewAtomicAddr);
|
||||
if ((LVal.isBitField() && BFI.Size != ValueSizeInBits) ||
|
||||
requiresMemSetZero(
|
||||
getAtomicAddress()->getType()->getPointerElementType())) {
|
||||
CGF.Builder.CreateAlignedStore(PHI, NewAtomicIntAddr,
|
||||
getAtomicAlignment().getQuantity());
|
||||
}
|
||||
EmitAtomicUpdateValue(CGF, *this, UpdateRVal, NewAtomicAddr);
|
||||
auto *DesiredVal = CGF.Builder.CreateAlignedLoad(
|
||||
NewAtomicIntAddr, getAtomicAlignment().getQuantity());
|
||||
// Try to write new value using cmpxchg operation
|
||||
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
||||
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
||||
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
||||
CGF.EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdate(
|
||||
llvm::AtomicOrdering AO, const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile) {
|
||||
if (shouldUseLibcall()) {
|
||||
EmitAtomicUpdateLibcall(AO, UpdateOp, IsVolatile);
|
||||
} else {
|
||||
EmitAtomicUpdateOp(AO, UpdateOp, IsVolatile);
|
||||
}
|
||||
}
|
||||
|
||||
void AtomicInfo::EmitAtomicUpdate(llvm::AtomicOrdering AO, RValue UpdateRVal,
|
||||
bool IsVolatile) {
|
||||
if (shouldUseLibcall()) {
|
||||
EmitAtomicUpdateLibcall(AO, UpdateRVal, IsVolatile);
|
||||
} else {
|
||||
EmitAtomicUpdateOp(AO, UpdateRVal, IsVolatile);
|
||||
}
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitAtomicStore(RValue rvalue, LValue lvalue,
|
||||
|
@ -1465,46 +1715,8 @@ void CodeGenFunction::EmitAtomicStore(RValue rvalue, LValue dest,
|
|||
return;
|
||||
}
|
||||
|
||||
// Atomic load of prev value.
|
||||
RValue OldRVal =
|
||||
atomics.EmitAtomicLoad(AggValueSlot::ignored(), SourceLocation(),
|
||||
/*AsValue=*/false, AO, IsVolatile);
|
||||
// For non-simple lvalues perform compare-and-swap procedure.
|
||||
auto *ContBB = createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = createBasicBlock("atomic_exit");
|
||||
auto *CurBB = Builder.GetInsertBlock();
|
||||
EmitBlock(ContBB);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(OldRVal.getScalarVal()->getType(),
|
||||
/*NumReservedValues=*/2);
|
||||
PHI->addIncoming(OldRVal.getScalarVal(), CurBB);
|
||||
RValue OriginalRValue = RValue::get(PHI);
|
||||
// Build new lvalue for temp address
|
||||
auto *Ptr = atomics.materializeRValue(OriginalRValue);
|
||||
// Build new lvalue for temp address
|
||||
LValue UpdateLVal;
|
||||
if (LVal.isBitField())
|
||||
UpdateLVal = LValue::MakeBitfield(Ptr, LVal.getBitFieldInfo(),
|
||||
LVal.getType(), LVal.getAlignment());
|
||||
else if (LVal.isVectorElt())
|
||||
UpdateLVal = LValue::MakeVectorElt(Ptr, LVal.getVectorIdx(), LVal.getType(),
|
||||
LVal.getAlignment());
|
||||
else {
|
||||
assert(LVal.isExtVectorElt());
|
||||
UpdateLVal = LValue::MakeExtVectorElt(Ptr, LVal.getExtVectorElts(),
|
||||
LVal.getType(), LVal.getAlignment());
|
||||
}
|
||||
UpdateLVal.setTBAAInfo(LVal.getTBAAInfo());
|
||||
// Store new value in the corresponding memory area
|
||||
EmitStoreThroughLValue(rvalue, UpdateLVal);
|
||||
// Load new value
|
||||
RValue NewRValue = RValue::get(EmitLoadOfScalar(
|
||||
Ptr, LVal.isVolatile(), atomics.getAtomicAlignment().getQuantity(),
|
||||
atomics.getAtomicType(), SourceLocation()));
|
||||
// Try to write new value using cmpxchg operation
|
||||
auto Pair = atomics.EmitAtomicCompareExchange(OriginalRValue, NewRValue, AO);
|
||||
PHI->addIncoming(Pair.first.getScalarVal(), Builder.GetInsertBlock());
|
||||
Builder.CreateCondBr(Pair.second, ExitBB, ContBB);
|
||||
EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
// Emit simple atomic update operation.
|
||||
atomics.EmitAtomicUpdate(AO, rvalue, IsVolatile);
|
||||
}
|
||||
|
||||
/// Emit a compare-and-exchange op for atomic type.
|
||||
|
@ -1529,72 +1741,9 @@ std::pair<RValue, llvm::Value *> CodeGenFunction::EmitAtomicCompareExchange(
|
|||
|
||||
void CodeGenFunction::EmitAtomicUpdate(
|
||||
LValue LVal, llvm::AtomicOrdering AO,
|
||||
const std::function<RValue(RValue)> &UpdateOp, bool IsVolatile) {
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp, bool IsVolatile) {
|
||||
AtomicInfo Atomics(*this, LVal);
|
||||
LValue AtomicLVal = Atomics.getAtomicLValue();
|
||||
|
||||
// Atomic load of prev value.
|
||||
RValue OldRVal =
|
||||
Atomics.EmitAtomicLoad(AggValueSlot::ignored(), SourceLocation(),
|
||||
/*AsValue=*/false, AO, IsVolatile);
|
||||
bool IsScalar = OldRVal.isScalar();
|
||||
auto *OldVal =
|
||||
IsScalar ? OldRVal.getScalarVal() : Atomics.convertRValueToInt(OldRVal);
|
||||
// For non-simple lvalues perform compare-and-swap procedure.
|
||||
auto *ContBB = createBasicBlock("atomic_cont");
|
||||
auto *ExitBB = createBasicBlock("atomic_exit");
|
||||
auto *CurBB = Builder.GetInsertBlock();
|
||||
EmitBlock(ContBB);
|
||||
llvm::PHINode *PHI = Builder.CreatePHI(OldVal->getType(),
|
||||
/*NumReservedValues=*/2);
|
||||
PHI->addIncoming(OldVal, CurBB);
|
||||
RValue OriginalRValue =
|
||||
IsScalar ? RValue::get(PHI) : Atomics.ConvertIntToValueOrAtomic(
|
||||
PHI, AggValueSlot::ignored(),
|
||||
SourceLocation(), /*AsValue=*/false);
|
||||
// Build new lvalue for temp address
|
||||
LValue UpdateLVal;
|
||||
llvm::Value *Ptr = nullptr;
|
||||
RValue UpRVal;
|
||||
if (AtomicLVal.isSimple()) {
|
||||
UpRVal = OriginalRValue;
|
||||
} else {
|
||||
// Build new lvalue for temp address
|
||||
Ptr = Atomics.materializeRValue(OriginalRValue);
|
||||
if (AtomicLVal.isBitField())
|
||||
UpdateLVal =
|
||||
LValue::MakeBitfield(Ptr, AtomicLVal.getBitFieldInfo(),
|
||||
AtomicLVal.getType(), AtomicLVal.getAlignment());
|
||||
else if (AtomicLVal.isVectorElt())
|
||||
UpdateLVal = LValue::MakeVectorElt(Ptr, AtomicLVal.getVectorIdx(),
|
||||
AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
else {
|
||||
assert(AtomicLVal.isExtVectorElt());
|
||||
UpdateLVal = LValue::MakeExtVectorElt(Ptr, AtomicLVal.getExtVectorElts(),
|
||||
AtomicLVal.getType(),
|
||||
AtomicLVal.getAlignment());
|
||||
}
|
||||
UpdateLVal.setTBAAInfo(LVal.getTBAAInfo());
|
||||
UpRVal = EmitLoadOfLValue(UpdateLVal, SourceLocation());
|
||||
}
|
||||
// Store new value in the corresponding memory area
|
||||
RValue NewRVal = UpdateOp(UpRVal);
|
||||
if (!AtomicLVal.isSimple()) {
|
||||
EmitStoreThroughLValue(NewRVal, UpdateLVal);
|
||||
// Load new value
|
||||
NewRVal = RValue::get(
|
||||
EmitLoadOfScalar(Ptr, AtomicLVal.isVolatile(),
|
||||
Atomics.getAtomicAlignment().getQuantity(),
|
||||
Atomics.getAtomicType(), SourceLocation()));
|
||||
}
|
||||
// Try to write new value using cmpxchg operation
|
||||
auto Pair = Atomics.EmitAtomicCompareExchange(OriginalRValue, NewRVal, AO);
|
||||
OldVal = IsScalar ? Pair.first.getScalarVal()
|
||||
: Atomics.convertRValueToInt(Pair.first);
|
||||
PHI->addIncoming(OldVal, Builder.GetInsertBlock());
|
||||
Builder.CreateCondBr(Pair.second, ExitBB, ContBB);
|
||||
EmitBlock(ExitBB, /*IsFinished=*/true);
|
||||
Atomics.EmitAtomicUpdate(AO, UpdateOp, IsVolatile);
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitAtomicInit(Expr *init, LValue dest) {
|
||||
|
|
|
@ -2272,7 +2272,7 @@ public:
|
|||
bool IsWeak = false, AggValueSlot Slot = AggValueSlot::ignored());
|
||||
|
||||
void EmitAtomicUpdate(LValue LVal, llvm::AtomicOrdering AO,
|
||||
const std::function<RValue(RValue)> &UpdateOp,
|
||||
const llvm::function_ref<RValue(RValue)> &UpdateOp,
|
||||
bool IsVolatile);
|
||||
|
||||
/// EmitToMemory - Change a scalar value from its value
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,6 +37,8 @@ void parallel_atomic_ewc() {
|
|||
// CHECK: [[OMP_UPDATE]]
|
||||
// CHECK: [[OLD_PHI_VAL:%.+]] = phi i32 [ [[OLD_VAL]], %{{.+}} ], [ [[NEW_OLD_VAL:%.+]], %[[OMP_UPDATE]] ]
|
||||
// CHECK: [[NEW_VAL:%.+]] = srem i32 [[OLD_PHI_VAL]], [[B_VAL]]
|
||||
// CHECK: store i32 [[NEW_VAL]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[SCALAR_ADDR]], i32 [[OLD_PHI_VAL]], i32 [[NEW_VAL]] monotonic monotonic
|
||||
// CHECK: [[NEW_OLD_VAL]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -52,13 +54,15 @@ void parallel_atomic_ewc() {
|
|||
// CHECK: br label %[[OMP_UPDATE:.+]]
|
||||
// CHECK: [[OMP_UPDATE]]
|
||||
// CHECK: [[OLD_PHI_VAL:%.+]] = phi i32 [ [[OLD_VAL]], %{{.+}} ], [ [[NEW_OLD_VAL:%.+]], %[[OMP_UPDATE]] ]
|
||||
// CHECK: [[NEW_VAL:%.+]] = srem i32 [[OLD_PHI_VAL]], [[B_VAL]]
|
||||
// CHECK: [[NEW_CALC_VAL:%.+]] = srem i32 [[OLD_PHI_VAL]], [[B_VAL]]
|
||||
// CHECK: store i32 [[NEW_CALC_VAL]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[SCALAR_ADDR]], i32 [[OLD_PHI_VAL]], i32 [[NEW_VAL]] monotonic monotonic
|
||||
// CHECK: [[NEW_OLD_VAL]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
|
||||
// CHECK: [[OMP_DONE]]
|
||||
// CHECK: store i32 [[NEW_VAL]], i32* @a,
|
||||
// CHECK: store i32 [[NEW_CALC_VAL]], i32* @a,
|
||||
// CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
|
||||
#pragma omp atomic capture
|
||||
a = St().get() %= b;
|
||||
|
|
|
@ -99,6 +99,8 @@ int main() {
|
|||
// CHECK: [[CONV:%.+]] = zext i16 [[EXPECTED]] to i32
|
||||
// CHECK: [[ADD:%.+]] = add nsw i32 [[CONV]], [[EXPR]]
|
||||
// CHECK: [[DESIRED:%.+]] = trunc i32 [[ADD]] to i16
|
||||
// CHECK: store i16 [[DESIRED]], i16* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i16, i16* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i16* [[X_ADDR]], i16 [[EXPECTED]], i16 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i16, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i16, i1 } [[RES]], 1
|
||||
|
@ -112,6 +114,8 @@ int main() {
|
|||
// CHECK: [[CONT]]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i32 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[DESIRED:%.+]] = mul nsw i32 [[EXPECTED]], [[EXPR]]
|
||||
// CHECK: store i32 [[DESIRED]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[X_ADDR]], i32 [[EXPECTED]], i32 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -129,6 +133,8 @@ int main() {
|
|||
// CHECK: [[CONT]]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i32 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[DESIRED:%.+]] = shl i32 [[EXPECTED]], [[EXPR]]
|
||||
// CHECK: store i32 [[DESIRED]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[X_ADDR]], i32 [[EXPECTED]], i32 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -142,6 +148,8 @@ int main() {
|
|||
// CHECK: [[CONT]]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i32 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[DESIRED:%.+]] = lshr i32 [[EXPECTED]], [[EXPR]]
|
||||
// CHECK: store i32 [[DESIRED]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[X_ADDR]], i32 [[EXPECTED]], i32 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -155,6 +163,8 @@ int main() {
|
|||
// CHECK: [[CONT]]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[DESIRED:%.+]] = sdiv i64 [[EXPECTED]], [[EXPR]]
|
||||
// CHECK: store i64 [[DESIRED]], i64* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* [[X_ADDR]], i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -176,95 +186,69 @@ int main() {
|
|||
ullx |= ullv;
|
||||
// CHECK: [[EXPR:%.+]] = load float, float* @{{.+}},
|
||||
// CHECK: [[OLD:%.+]] = load atomic i32, i32* bitcast (float* [[X_ADDR:@.+]] to i32*) monotonic
|
||||
// CHECK: [[X:%.+]] = bitcast i32 [[OLD]] to float
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi float [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i32 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast float* [[TEMP:%.+]] to i32*
|
||||
// CHECK: [[OLD:%.+]] = bitcast i32 [[EXPECTED]] to float
|
||||
// CHECK: [[ADD:%.+]] = fadd float [[OLD]], [[EXPR]]
|
||||
// CHECK: [[EXPECTED:%.+]] = bitcast float [[OLD]] to i32
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast float [[ADD]] to i32
|
||||
// CHECK: store float [[ADD]], float* [[TEMP]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i32, i32* [[BITCAST]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* bitcast (float* [[X_ADDR]] to i32*), i32 [[EXPECTED]], i32 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = bitcast i32 [[PREV]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
fx = fx + fv;
|
||||
// CHECK: [[EXPR:%.+]] = load double, double* @{{.+}},
|
||||
// CHECK: [[OLD:%.+]] = load atomic i64, i64* bitcast (double* [[X_ADDR:@.+]] to i64*) monotonic
|
||||
// CHECK: [[X:%.+]] = bitcast i64 [[OLD]] to double
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi double [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i64 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast double* [[TEMP:%.+]] to i64*
|
||||
// CHECK: [[OLD:%.+]] = bitcast i64 [[EXPECTED]] to double
|
||||
// CHECK: [[SUB:%.+]] = fsub double [[EXPR]], [[OLD]]
|
||||
// CHECK: [[EXPECTED:%.+]] = bitcast double [[OLD]] to i64
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast double [[SUB]] to i64
|
||||
// CHECK: store double [[SUB]], double* [[TEMP]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[BITCAST]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (double* [[X_ADDR]] to i64*), i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = bitcast i64 [[PREV]] to double
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
dx = dv - dx;
|
||||
// CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}},
|
||||
// CHECK: [[OLD:%.+]] = load atomic i128, i128* bitcast (x86_fp80* [[X_ADDR:@.+]] to i128*) monotonic
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[OLD]], i128* [[BITCAST]]
|
||||
// CHECK: [[X:%.+]] = load x86_fp80, x86_fp80* [[TEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi x86_fp80 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i128 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[EXPECTED]], i128* [[BITCAST]],
|
||||
// CHECK: [[BITCAST1:%.+]] = bitcast x86_fp80* [[TEMP1:%.+]] to i128*
|
||||
// CHECK: store i128 [[EXPECTED]], i128* [[BITCAST1]],
|
||||
// CHECK: [[OLD:%.+]] = load x86_fp80, x86_fp80* [[TEMP1]]
|
||||
// CHECK: [[MUL:%.+]] = fmul x86_fp80 [[OLD]], [[EXPR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i8*
|
||||
// CHECK: call void @llvm.memset.p0i8.i64(i8* [[BITCAST]], i8 0, i64 16, i32 16, i1 false)
|
||||
// CHECK: store x86_fp80 [[OLD]], x86_fp80* [[TEMP]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP]] to i128*
|
||||
// CHECK: [[EXPECTED:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i8*
|
||||
// CHECK: call void @llvm.memset.p0i8.i64(i8* [[BITCAST]], i8 0, i64 16, i32 16, i1 false)
|
||||
// CHECK: store x86_fp80 [[MUL]], x86_fp80* [[TEMP]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP]] to i128*
|
||||
// CHECK: [[DESIRED:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i128* bitcast (x86_fp80* [[X_ADDR]] to i128*), i128 [[EXPECTED]], i128 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i128, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i128, i1 } [[RES]], 1
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[PREV]], i128* [[BITCAST]]
|
||||
// CHECK: [[OLD_X]] = load x86_fp80, x86_fp80* [[TEMP]],
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
ldx = ldx * ldv;
|
||||
// CHECK: [[EXPR_RE:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* @{{.+}}, i32 0, i32 0)
|
||||
// CHECK: [[EXPR_IM:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* @{{.+}}, i32 0, i32 1)
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i8*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR:@.+]] to i8*), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[LD_RE:%.+]] = load i32, i32* [[LD_RE_ADDR]]
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[LD_IM:%.+]] = load i32, i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[LD_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[LD_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[X:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD]], i64* [[BITCAST]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// <Skip checks for complex calculations>
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[X_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 %{{.+}}, i32* [[X_RE_ADDR]]
|
||||
|
@ -272,48 +256,21 @@ int main() {
|
|||
// CHECK: [[EXPECTED:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR]] to i8*
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast { i32, i32 }* [[DESIRED_ADDR]] to i8*
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR]] to i8*), i8* [[EXPECTED]], i8* [[DESIRED]], i32 0, i32 0)
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[OLD_X]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
cix = civ / cix;
|
||||
// CHECK: [[EXPR_RE:%.+]] = load float, float* getelementptr inbounds ({ float, float }, { float, float }* @{{.+}}, i32 0, i32 0)
|
||||
// CHECK: [[EXPR_IM:%.+]] = load float, float* getelementptr inbounds ({ float, float }, { float, float }* @{{.+}}, i32 0, i32 1)
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { float, float }* [[TEMP:%.+]] to i8*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { float, float }* [[EXPECTED_ADDR:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 8, i8* bitcast ({ float, float }* [[X_ADDR:@.+]] to i8*), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[LD_RE:%.+]] = load float, float* [[LD_RE_ADDR]]
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[LD_IM:%.+]] = load float, float* [[LD_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store float [[LD_RE]], float* [[LD_RE_ADDR]]
|
||||
// CHECK: store float [[LD_IM]], float* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { float, float }* [[TEMP]] to i64*
|
||||
// CHECK: [[X:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { float, float }* [[TEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD]], i64* [[BITCAST]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[EXPECTED_ADDR]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load float, float* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load float, float* [[X_IM_ADDR]]
|
||||
// <Skip checks for complex calculations>
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[EXPECTED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store float [[X_RE]], float* [[X_RE_ADDR]]
|
||||
// CHECK: store float [[X_IM]], float* [[X_IM_ADDR]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[DESIRED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[DESIRED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store float %{{.+}}, float* [[X_RE_ADDR]]
|
||||
|
@ -321,48 +278,21 @@ int main() {
|
|||
// CHECK: [[EXPECTED:%.+]] = bitcast { float, float }* [[EXPECTED_ADDR]] to i8*
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast { float, float }* [[DESIRED_ADDR]] to i8*
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 8, i8* bitcast ({ float, float }* [[X_ADDR]] to i8*), i8* [[EXPECTED]], i8* [[DESIRED]], i32 0, i32 0)
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load float, float* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load float, float* [[X_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store float [[X_RE]], float* [[LD_RE_ADDR]]
|
||||
// CHECK: store float [[X_IM]], float* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { float, float }* [[TEMP]] to i64*
|
||||
// CHECK: [[OLD_X]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
cfx = cfv + cfx;
|
||||
// CHECK: [[EXPR_RE:%.+]] = load double, double* getelementptr inbounds ({ double, double }, { double, double }* @{{.+}}, i32 0, i32 0)
|
||||
// CHECK: [[EXPR_IM:%.+]] = load double, double* getelementptr inbounds ({ double, double }, { double, double }* @{{.+}}, i32 0, i32 1)
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { double, double }* [[TEMP:%.+]] to i8*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { double, double }* [[EXPECTED_ADDR:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 16, i8* bitcast ({ double, double }* [[X_ADDR:@.+]] to i8*), i8* [[BITCAST]], i32 5)
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[LD_RE:%.+]] = load double, double* [[LD_RE_ADDR]]
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[LD_IM:%.+]] = load double, double* [[LD_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store double [[LD_RE]], double* [[LD_RE_ADDR]]
|
||||
// CHECK: store double [[LD_IM]], double* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { double, double }* [[TEMP]] to i128*
|
||||
// CHECK: [[X:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i128 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { double, double }* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[OLD]], i128* [[BITCAST]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[EXPECTED_ADDR]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load double, double* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load double, double* [[X_IM_ADDR]]
|
||||
// <Skip checks for complex calculations>
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[EXPECTED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store double [[X_RE]], double* [[X_RE_ADDR]]
|
||||
// CHECK: store double [[X_IM]], double* [[X_IM_ADDR]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[DESIRED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[DESIRED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store double %{{.+}}, double* [[X_RE_ADDR]]
|
||||
|
@ -370,16 +300,6 @@ int main() {
|
|||
// CHECK: [[EXPECTED:%.+]] = bitcast { double, double }* [[EXPECTED_ADDR]] to i8*
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast { double, double }* [[DESIRED_ADDR]] to i8*
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 16, i8* bitcast ({ double, double }* [[X_ADDR]] to i8*), i8* [[EXPECTED]], i8* [[DESIRED]], i32 5, i32 5)
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load double, double* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load double, double* [[X_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { double, double }, { double, double }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store double [[X_RE]], double* [[LD_RE_ADDR]]
|
||||
// CHECK: store double [[X_IM]], double* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { double, double }* [[TEMP]] to i128*
|
||||
// CHECK: [[OLD_X]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
// CHECK: call{{.*}} @__kmpc_flush(
|
||||
|
@ -394,19 +314,19 @@ int main() {
|
|||
// CHECK: [[CV:%.+]] = load i8, i8* @{{.+}}, align 1
|
||||
// CHECK: [[EXPR:%.+]] = sext i8 [[CV]] to i32
|
||||
// CHECK: [[BX:%.+]] = load atomic i8, i8* [[BX_ADDR:@.+]] monotonic
|
||||
// CHECK: [[X:%.+]] = trunc i8 [[BX]] to i1
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i1 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i8 [ [[BX]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[OLD:%.+]] = trunc i8 [[EXPECTED]] to i1
|
||||
// CHECK: [[X_RVAL:%.+]] = zext i1 [[OLD]] to i32
|
||||
// CHECK: [[AND:%.+]] = and i32 [[EXPR]], [[X_RVAL]]
|
||||
// CHECK: [[CAST:%.+]] = icmp ne i32 [[AND]], 0
|
||||
// CHECK: [[EXPECTED:%.+]] = zext i1 [[OLD]] to i8
|
||||
// CHECK: [[DESIRED:%.+]] = zext i1 [[CAST]] to i8
|
||||
// CHECK: store i8 [[DESIRED]], i8* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i8, i8* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* [[BX_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD:%.+]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[OLD_X:%.+]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = trunc i8 [[OLD]] to i1
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
|
@ -420,6 +340,8 @@ int main() {
|
|||
// CHECK: [[X_RVAL:%.+]] = sext i8 [[EXPECTED]] to i32
|
||||
// CHECK: [[ASHR:%.+]] = ashr i32 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[DESIRED:%.+]] = trunc i32 [[ASHR]] to i8
|
||||
// CHECK: store i8 [[DESIRED]], i8* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i8, i8* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* [[CX_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] seq_cst seq_cst
|
||||
// CHECK: [[OLD_X:%.+]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
|
@ -437,6 +359,8 @@ int main() {
|
|||
// CHECK: [[X_RVAL:%.+]] = trunc i64 [[EXPECTED]] to i32
|
||||
// CHECK: [[SHL:%.+]] = shl i32 [[EXPR]], [[X_RVAL]]
|
||||
// CHECK: [[DESIRED:%.+]] = sext i32 [[SHL]] to i64
|
||||
// CHECK: store i64 [[DESIRED]], i64* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* [[ULX_ADDR]], i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -451,6 +375,8 @@ int main() {
|
|||
// CHECK: [[CONT]]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[DESIRED:%.+]] = srem i64 [[EXPECTED]], [[EXPR]]
|
||||
// CHECK: store i64 [[DESIRED]], i64* [[TEMP:%.+]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* [[LX_ADDR]], i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -468,32 +394,15 @@ int main() {
|
|||
#pragma omp atomic
|
||||
ix = ix & uiv;
|
||||
// CHECK: [[EXPR:%.+]] = load i64, i64* @{{.+}},
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i8*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR:@.+]] to i8*), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[LD_RE:%.+]] = load i32, i32* [[LD_RE_ADDR]]
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[LD_IM:%.+]] = load i32, i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[LD_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[LD_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[X:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD]], i64* [[BITCAST]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// <Skip checks for complex calculations>
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[X_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 %{{.+}}, i32* [[X_RE_ADDR]]
|
||||
|
@ -501,16 +410,6 @@ int main() {
|
|||
// CHECK: [[EXPECTED:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR]] to i8*
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast { i32, i32 }* [[DESIRED_ADDR]] to i8*
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR]] to i8*), i8* [[EXPECTED]], i8* [[DESIRED]], i32 0, i32 0)
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[OLD_X]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -518,17 +417,17 @@ int main() {
|
|||
// CHECK: [[ULV:%.+]] = load i64, i64* @{{.+}},
|
||||
// CHECK: [[EXPR:%.+]] = uitofp i64 [[ULV]] to float
|
||||
// CHECK: [[OLD:%.+]] = load atomic i32, i32* bitcast (float* [[X_ADDR:@.+]] to i32*) monotonic
|
||||
// CHECK: [[X:%.+]] = bitcast i32 [[OLD]] to float
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi float [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i32 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast float* [[TEMP:%.+]] to i32*
|
||||
// CHECK: [[OLD:%.+]] = bitcast i32 [[EXPECTED]] to float
|
||||
// CHECK: [[MUL:%.+]] = fmul float [[OLD]], [[EXPR]]
|
||||
// CHECK: [[EXPECTED:%.+]] = bitcast float [[OLD]] to i32
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast float [[MUL]] to i32
|
||||
// CHECK: store float [[MUL]], float* [[TEMP]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i32, i32* [[BITCAST]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* bitcast (float* [[X_ADDR]] to i32*), i32 [[EXPECTED]], i32 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = bitcast i32 [[PREV]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
|
@ -536,17 +435,17 @@ int main() {
|
|||
// CHECK: [[LLV:%.+]] = load i64, i64* @{{.+}},
|
||||
// CHECK: [[EXPR:%.+]] = sitofp i64 [[LLV]] to double
|
||||
// CHECK: [[OLD:%.+]] = load atomic i64, i64* bitcast (double* [[X_ADDR:@.+]] to i64*) monotonic
|
||||
// CHECK: [[X:%.+]] = bitcast i64 [[OLD]] to double
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi double [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i64 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast double* [[TEMP:%.+]] to i64*
|
||||
// CHECK: [[OLD:%.+]] = bitcast i64 [[EXPECTED]] to double
|
||||
// CHECK: [[DIV:%.+]] = fdiv double [[OLD]], [[EXPR]]
|
||||
// CHECK: [[EXPECTED:%.+]] = bitcast double [[OLD]] to i64
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast double [[DIV]] to i64
|
||||
// CHECK: store double [[DIV]], double* [[TEMP]],
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[BITCAST]],
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (double* [[X_ADDR]] to i64*), i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = bitcast i64 [[PREV]] to double
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -554,60 +453,33 @@ int main() {
|
|||
// CHECK: [[ULLV:%.+]] = load i64, i64* @{{.+}},
|
||||
// CHECK: [[EXPR:%.+]] = uitofp i64 [[ULLV]] to x86_fp80
|
||||
// CHECK: [[OLD:%.+]] = load atomic i128, i128* bitcast (x86_fp80* [[X_ADDR:@.+]] to i128*) monotonic
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[OLD]], i128* [[BITCAST]]
|
||||
// CHECK: [[X:%.+]] = load x86_fp80, x86_fp80* [[TEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi x86_fp80 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i128 [ [[OLD]], %{{.+}} ], [ [[PREV:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST1:%.+]] = bitcast x86_fp80* [[TEMP1:%.+]] to i128*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[EXPECTED]], i128* [[BITCAST]]
|
||||
// CHECK: [[OLD:%.+]] = load x86_fp80, x86_fp80* [[TEMP]]
|
||||
// CHECK: [[SUB:%.+]] = fsub x86_fp80 [[OLD]], [[EXPR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i8*
|
||||
// CHECK: call void @llvm.memset.p0i8.i64(i8* [[BITCAST]], i8 0, i64 16, i32 16, i1 false)
|
||||
// CHECK: store x86_fp80 [[OLD]], x86_fp80* [[TEMP]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP]] to i128*
|
||||
// CHECK: [[EXPECTED:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i8*
|
||||
// CHECK: call void @llvm.memset.p0i8.i64(i8* [[BITCAST]], i8 0, i64 16, i32 16, i1 false)
|
||||
// CHECK: store x86_fp80 [[SUB]], x86_fp80* [[TEMP]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP]] to i128*
|
||||
// CHECK: [[DESIRED:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: store x86_fp80 [[SUB]], x86_fp80* [[TEMP1]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i128, i128* [[BITCAST1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i128* bitcast (x86_fp80* [[X_ADDR]] to i128*), i128 [[EXPECTED]], i128 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[PREV:%.+]] = extractvalue { i128, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i128, i1 } [[RES]], 1
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast x86_fp80* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[PREV]], i128* [[BITCAST]]
|
||||
// CHECK: [[OLD_X]] = load x86_fp80, x86_fp80* [[TEMP]],
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
ldx -= ullv;
|
||||
// CHECK: [[EXPR:%.+]] = load float, float* @{{.+}},
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i8*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR:@.+]] to i8*), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[LD_RE:%.+]] = load i32, i32* [[LD_RE_ADDR]]
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[LD_IM:%.+]] = load i32, i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[LD_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[LD_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[X:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD:%.+]] = phi i64 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD]], i64* [[BITCAST]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 0
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// <Skip checks for complex calculations>
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[EXPECTED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[X_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[DESIRED_ADDR]], i32 0, i32 1
|
||||
// CHECK: store i32 %{{.+}}, i32* [[X_RE_ADDR]]
|
||||
|
@ -615,16 +487,6 @@ int main() {
|
|||
// CHECK: [[EXPECTED:%.+]] = bitcast { i32, i32 }* [[EXPECTED_ADDR]] to i8*
|
||||
// CHECK: [[DESIRED:%.+]] = bitcast { i32, i32 }* [[DESIRED_ADDR]] to i8*
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 8, i8* bitcast ({ i32, i32 }* [[X_ADDR]] to i8*), i8* [[EXPECTED]], i8* [[DESIRED]], i32 0, i32 0)
|
||||
// CHECK: [[X_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[X_RE:%.+]] = load i32, i32* [[X_RE_ADDR]]
|
||||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load i32, i32* [[X_IM_ADDR]]
|
||||
// CHECK: [[LD_RE_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP:%.+]], i32 0, i32 0
|
||||
// CHECK: [[LD_IM_ADDR:%.+]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: store i32 [[X_RE]], i32* [[LD_RE_ADDR]]
|
||||
// CHECK: store i32 [[X_IM]], i32* [[LD_IM_ADDR]]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast { i32, i32 }* [[TEMP]] to i64*
|
||||
// CHECK: [[OLD_X]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -638,6 +500,8 @@ int main() {
|
|||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[CONV]] to double
|
||||
// CHECK: [[ADD:%.+]] = fadd double [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[DESIRED:%.+]] = fptosi double [[ADD]] to i16
|
||||
// CHECK: store i16 [[DESIRED]], i16* [[TEMP:%.+]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i16, i16* [[TEMP]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i16* [[X_ADDR]], i16 [[EXPECTED]], i16 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i16, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i16, i1 } [[RES]], 1
|
||||
|
@ -647,20 +511,20 @@ int main() {
|
|||
sx = sx + dv;
|
||||
// CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}},
|
||||
// CHECK: [[XI8:%.+]] = load atomic i8, i8* [[X_ADDR:@.+]] monotonic
|
||||
// CHECK: [[X:%.+]] = trunc i8 [[XI8]] to i1
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[BOOL_EXPECTED:%.+]] = phi i1 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i8 [ [[XI8]], %{{.+}} ], [ [[OLD_XI8:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BOOL_EXPECTED:%.+]] = trunc i8 [[EXPECTED]] to i1
|
||||
// CHECK: [[CONV:%.+]] = zext i1 [[BOOL_EXPECTED]] to i32
|
||||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[CONV]] to x86_fp80
|
||||
// CHECK: [[MUL:%.+]] = fmul x86_fp80 [[EXPR]], [[X_RVAL]]
|
||||
// CHECK: [[BOOL_DESIRED:%.+]] = fcmp une x86_fp80 [[MUL]], 0xK00000000000000000000
|
||||
// CHECK: [[EXPECTED:%.+]] = zext i1 [[BOOL_EXPECTED]] to i8
|
||||
// CHECK: [[DESIRED:%.+]] = zext i1 [[BOOL_DESIRED]] to i8
|
||||
// CHECK: store i8 [[DESIRED]], i8* [[TEMP:%.+]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i8, i8* [[TEMP]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* [[X_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_XI8:%.+]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = trunc i8 [[OLD_XI8]] to i1
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -668,22 +532,22 @@ int main() {
|
|||
// CHECK: [[EXPR_RE:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* [[CIV_ADDR:@.+]], i32 0, i32 0),
|
||||
// CHECK: [[EXPR_IM:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* [[CIV_ADDR]], i32 0, i32 1),
|
||||
// CHECK: [[XI8:%.+]] = load atomic i8, i8* [[X_ADDR:@.+]] monotonic
|
||||
// CHECK: [[X:%.+]] = trunc i8 [[XI8]] to i1
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[BOOL_EXPECTED:%.+]] = phi i1 [ [[X]], %{{.+}} ], [ [[OLD_X:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[EXPECTED:%.+]] = phi i8 [ [[XI8]], %{{.+}} ], [ [[OLD_XI8:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BOOL_EXPECTED:%.+]] = trunc i8 [[EXPECTED]] to i1
|
||||
// CHECK: [[X_RVAL:%.+]] = zext i1 [[BOOL_EXPECTED]] to i32
|
||||
// CHECK: [[SUB_RE:%.+]] = sub i32 [[EXPR_RE:%.+]], [[X_RVAL]]
|
||||
// CHECK: [[SUB_IM:%.+]] = sub i32 [[EXPR_IM:%.+]], 0
|
||||
// CHECK: icmp ne i32 [[SUB_RE]], 0
|
||||
// CHECK: icmp ne i32 [[SUB_IM]], 0
|
||||
// CHECK: [[BOOL_DESIRED:%.+]] = or i1
|
||||
// CHECK: [[EXPECTED:%.+]] = zext i1 [[BOOL_EXPECTED]] to i8
|
||||
// CHECK: [[DESIRED:%.+]] = zext i1 [[BOOL_DESIRED]] to i8
|
||||
// CHECK: store i8 [[DESIRED]], i8* [[TEMP:%.+]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i8, i8* [[TEMP]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* [[X_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_XI8:%.+]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD_X]] = trunc i8 [[OLD_XI8]] to i1
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
|
@ -702,6 +566,8 @@ int main() {
|
|||
// CHECK: [[X_IM_ADDR:%.+]] = getelementptr inbounds { float, float }, { float, float }* [[TEMP]], i32 0, i32 1
|
||||
// CHECK: [[X_IM:%.+]] = load float, float* [[X_IM_ADDR]]
|
||||
// CHECK: [[DESIRED:%.+]] = fptoui float [[X_RE]] to i16
|
||||
// CHECK: store i16 [[DESIRED]], i16* [[TEMP:%.+]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i16, i16* [[TEMP]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i16* [[X_ADDR]], i16 [[EXPECTED]], i16 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i16, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i16, i1 } [[RES]], 1
|
||||
|
@ -719,6 +585,8 @@ int main() {
|
|||
// CHECK: [[ADD_RE:%.+]] = fadd double [[X_RVAL]], [[EXPR_RE]]
|
||||
// CHECK: [[ADD_IM:%.+]] = fadd double 0.000000e+00, [[EXPR_IM]]
|
||||
// CHECK: [[DESIRED:%.+]] = fptosi double [[ADD_RE]] to i64
|
||||
// CHECK: store i64 [[DESIRED]], i64* [[TEMP:%.+]]
|
||||
// CHECK: [[DESIRED:%.+]] = load i64, i64* [[TEMP]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* [[X_ADDR]], i64 [[EXPECTED]], i64 [[DESIRED]] monotonic monotonic
|
||||
// CHECK: [[OLD_X]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -730,24 +598,23 @@ int main() {
|
|||
// CHECK: load i8, i8*
|
||||
// CHECK: [[VEC_ITEM_VAL:%.+]] = zext i1 %{{.+}} to i32
|
||||
// CHECK: [[I128VAL:%.+]] = load atomic i128, i128* bitcast (<4 x i32>* [[DEST:@.+]] to i128*) monotonic
|
||||
// CHECK: [[LD:%.+]] = bitcast i128 [[I128VAL]] to <4 x i32>
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = phi <4 x i32> [ [[LD]], %{{.+}} ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[OLD_I128:%.+]] = phi i128 [ [[I128VAL]], %{{.+}} ], [ [[FAILED_I128_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast <4 x i32>* [[TEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[OLD_I128]], i128* [[BITCAST]],
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = bitcast i128 [[OLD_I128]] to <4 x i32>
|
||||
// CHECK: store <4 x i32> [[OLD_VEC_VAL]], <4 x i32>* [[LDTEMP:%.+]],
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[ITEM:%.+]] = extractelement <4 x i32> [[VEC_VAL]], i16 [[IDX]]
|
||||
// CHECK: [[OR:%.+]] = or i32 [[ITEM]], [[VEC_ITEM_VAL]]
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[TEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = insertelement <4 x i32> [[VEC_VAL]], i32 [[OR]], i16 [[IDX]]
|
||||
// CHECK: store <4 x i32> [[NEW_VEC_VAL]], <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[OLD_I128:%.+]] = bitcast <4 x i32> [[OLD_VEC_VAL]] to i128
|
||||
// CHECK: [[NEW_I128:%.+]] = bitcast <4 x i32> [[NEW_VEC_VAL]] to i128
|
||||
// CHECK: store <4 x i32> [[NEW_VEC_VAL]], <4 x i32>* [[TEMP]]
|
||||
// CHECK: [[NEW_I128:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i128* bitcast (<4 x i32>* [[DEST]] to i128*), i128 [[OLD_I128]], i128 [[NEW_I128]] monotonic monotonic
|
||||
// CHECK: [[FAILED_I128_OLD_VAL:%.+]] = extractvalue { i128, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i128, i1 } [[RES]], 1
|
||||
// CHECK: [[FAILED_OLD_VAL]] = bitcast i128 [[FAILED_I128_OLD_VAL]] to <4 x i32>
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -757,6 +624,7 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i32 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP1:%.+]],
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i32 [[A_LD]], 1
|
||||
|
@ -764,12 +632,12 @@ int main() {
|
|||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[A_ASHR]] to x86_fp80
|
||||
// CHECK: [[SUB:%.+]] = fsub x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[CONV:%.+]] = fptosi x86_fp80 [[SUB]] to i32
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP1]],
|
||||
// CHECK: [[BF_VALUE:%.+]] = and i32 [[CONV]], 2147483647
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 [[NEW_VAL]], -2147483648
|
||||
// CHECK: or i32 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[TEMP1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[TEMP1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* bitcast (i8* getelementptr (i8, i8* bitcast (%struct.BitFields* @{{.+}} to i8*), i64 4) to i32*), i32 [[OLD_BF_VALUE]], i32 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -780,29 +648,26 @@ int main() {
|
|||
// CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}}
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i32* [[LDTEMP:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 4, i8* getelementptr (i8, i8* bitcast (%struct.BitFields_packed* @{{.+}} to i8*), i64 4), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i32 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 [[PREV_VALUE]], i32* [[TEMP1:%.+]],
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 [[PREV_VALUE]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i32 [[A_LD]], 1
|
||||
// CHECK: [[A_ASHR:%.+]] = ashr i32 [[A_SHL]], 1
|
||||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[A_ASHR]] to x86_fp80
|
||||
// CHECK: [[MUL:%.+]] = fmul x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[CONV:%.+]] = fptosi x86_fp80 [[MUL]] to i32
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP1]],
|
||||
// CHECK: [[BF_VALUE:%.+]] = and i32 [[CONV]], 2147483647
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 [[NEW_VAL]], -2147483648
|
||||
// CHECK: or i32 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP_OLD_BF_ADDR:%.+]],
|
||||
// CHECK: store i32 [[NEW_BF_VALUE]], i32* [[TEMP_NEW_BF_ADDR:%.+]],
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* [[TEMP_OLD_BF_ADDR]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* [[TEMP_NEW_BF_ADDR]] to i8*
|
||||
// CHECK: store i32 %{{.+}}, i32* [[TEMP1]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* [[LDTEMP]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* [[TEMP1]] to i8*
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 4, i8* getelementptr (i8, i8* bitcast (%struct.BitFields_packed* @{{.+}} to i8*), i64 4), i8* [[BITCAST_TEMP_OLD_BF_ADDR]], i8* [[BITCAST_TEMP_NEW_BF_ADDR]], i32 0, i32 0)
|
||||
// CHECK: [[FAILED_OLD_VAL]] = load i32, i32* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -812,19 +677,20 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i32 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP1:%.+]],
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[A_ASHR:%.+]] = ashr i32 [[A_LD]], 31
|
||||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[A_ASHR]] to x86_fp80
|
||||
// CHECK: [[SUB:%.+]] = fsub x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[CONV:%.+]] = fptosi x86_fp80 [[SUB]] to i32
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[NEW_VAL:%.+]] = load i32, i32* [[TEMP1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i32 [[CONV]], 1
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i32 [[BF_AND]], 31
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 [[NEW_VAL]], 2147483647
|
||||
// CHECK: or i32 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[TEMP1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[TEMP1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* getelementptr inbounds (%struct.BitFields2, %struct.BitFields2* @{{.+}}, i32 0, i32 0), i32 [[OLD_BF_VALUE]], i32 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -837,6 +703,8 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i8 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST1:%.+]] = bitcast i32* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST1]],
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i32* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST]],
|
||||
// CHECK: [[A_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
|
@ -846,13 +714,13 @@ int main() {
|
|||
// CHECK: [[DIV:%.+]] = fdiv x86_fp80 [[EXPR]], [[X_RVAL]]
|
||||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 [[DIV]] to i32
|
||||
// CHECK: [[TRUNC:%.+]] = trunc i32 [[NEW_VAL]] to i8
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i8 [[TRUNC]], 1
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i8 [[BF_AND]], 7
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i8 %{{.+}}, 127
|
||||
// CHECK: or i8 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[LDTEMP]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[BITCAST1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[BITCAST1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr (i8, i8* bitcast (%struct.BitFields2_packed* @{{.+}} to i8*), i64 3), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
|
@ -865,6 +733,7 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i32 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP1:%.+]],
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i32 [[A_LD]], 7
|
||||
|
@ -872,13 +741,13 @@ int main() {
|
|||
// CHECK: [[X_RVAL:%.+]] = sitofp i32 [[A_ASHR]] to x86_fp80
|
||||
// CHECK: [[DIV:%.+]] = fdiv x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 [[DIV]] to i32
|
||||
// CHECK: [[BF_LD:%.+]] = load i32, i32* [[TEMP]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i32, i32* [[TEMP1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i32 [[NEW_VAL]], 16383
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i32 [[BF_AND]], 11
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 %{{.+}}, -33552385
|
||||
// CHECK: or i32 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[TEMP1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[TEMP1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* getelementptr inbounds (%struct.BitFields3, %struct.BitFields3* @{{.+}}, i32 0, i32 0), i32 [[OLD_BF_VALUE]], i32 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
|
@ -890,13 +759,13 @@ int main() {
|
|||
// CHECK: [[LDTEMP:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i24* %{{.+}} to i8*
|
||||
// CHECK: call void @__atomic_load(i64 3, i8* getelementptr (i8, i8* bitcast (%struct.BitFields3_packed* @{{.+}} to i8*), i64 1), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i24 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: store i24 [[OLD_BF_VALUE]], i24* [[BITCAST]],
|
||||
// CHECK: [[A_LD:%.+]] = load i24, i24* [[BITCAST]],
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: store i24 [[PREV_VALUE]], i24* [[TEMP1:%.+]],
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: store i24 [[PREV_VALUE]], i24* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i24, i24* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i24 [[A_LD]], 7
|
||||
// CHECK: [[A_ASHR:%.+]] = ashr i24 [[A_SHL]], 10
|
||||
// CHECK: [[CAST:%.+]] = sext i24 [[A_ASHR]] to i32
|
||||
|
@ -904,21 +773,15 @@ int main() {
|
|||
// CHECK: [[ADD:%.+]] = fadd x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 [[ADD]] to i32
|
||||
// CHECK: [[TRUNC:%.+]] = trunc i32 [[NEW_VAL]] to i24
|
||||
// CHECK: [[BF_LD:%.+]] = load i24, i24* [[BITCAST]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i24, i24* [[TEMP1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i24 [[TRUNC]], 16383
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i24 [[BF_AND]], 3
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i24 [[BF_LD]], -131065
|
||||
// CHECK: or i24 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i24 %{{.+}}, i24* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: [[TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: store i24 [[OLD_BF_VALUE]], i24* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: [[TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: store i24 [[NEW_BF_VALUE]], i24* [[TEMP_NEW_BF_ADDR]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i24* [[TEMP_OLD_BF_ADDR]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i24* [[TEMP_NEW_BF_ADDR]] to i8*
|
||||
// CHECK: store i24 %{{.+}}, i24* [[TEMP1]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i24* [[LDTEMP]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i24* [[TEMP1]] to i8*
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 3, i8* getelementptr (i8, i8* bitcast (%struct.BitFields3_packed* @{{.+}} to i8*), i64 1), i8* [[BITCAST_TEMP_OLD_BF_ADDR]], i8* [[BITCAST_TEMP_NEW_BF_ADDR]], i32 0, i32 0)
|
||||
// CHECK: [[FAILED_OLD_VAL]] = load i24, i24* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic update
|
||||
|
@ -928,6 +791,7 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i64 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i64 [[OLD_BF_VALUE]], i64* [[TEMP1:%.+]],
|
||||
// CHECK: store i64 [[OLD_BF_VALUE]], i64* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i64 [[A_LD]], 47
|
||||
|
@ -937,13 +801,13 @@ int main() {
|
|||
// CHECK: [[MUL:%.+]] = fmul x86_fp80 [[X_RVAL]], [[EXPR]]
|
||||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 [[MUL]] to i32
|
||||
// CHECK: [[ZEXT:%.+]] = zext i32 [[NEW_VAL]] to i64
|
||||
// CHECK: [[BF_LD:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i64, i64* [[TEMP1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i64 [[ZEXT]], 1
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i64 [[BF_AND]], 16
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i64 [[BF_LD]], -65537
|
||||
// CHECK: or i64 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i64 %{{.+}}, i64* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[LDTEMP]]
|
||||
// CHECK: store i64 %{{.+}}, i64* [[TEMP1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[TEMP1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -956,6 +820,8 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i8 [ [[PREV_VALUE]], %{{.+}} ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST1:%.+]] = bitcast i32* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST1]],
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i32* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST]],
|
||||
// CHECK: [[A_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
|
@ -966,12 +832,12 @@ int main() {
|
|||
// CHECK: [[SUB: %.+]] = fsub x86_fp80 [[CONV]], [[EXPR]]
|
||||
// CHECK: [[CONV:%.+]] = fptosi x86_fp80 [[SUB:%.+]] to i32
|
||||
// CHECK: [[NEW_VAL:%.+]] = trunc i32 [[CONV]] to i8
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST1]],
|
||||
// CHECK: [[BF_VALUE:%.+]] = and i8 [[NEW_VAL]], 1
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i8 [[BF_LD]], -2
|
||||
// CHECK: or i8 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[LDTEMP]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[BITCAST1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[BITCAST1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
|
@ -984,6 +850,7 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i64 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store i64 [[OLD_BF_VALUE]], i64* [[TEMP1:%.+]],
|
||||
// CHECK: store i64 [[OLD_BF_VALUE]], i64* [[TEMP:%.+]],
|
||||
// CHECK: [[A_LD:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[A_SHL:%.+]] = shl i64 [[A_LD]], 40
|
||||
|
@ -991,13 +858,13 @@ int main() {
|
|||
// CHECK: [[CONV:%.+]] = sitofp i64 [[A_ASHR]] to x86_fp80
|
||||
// CHECK: [[DIV:%.+]] = fdiv x86_fp80 [[CONV]], [[EXPR]]
|
||||
// CHECK: [[CONV:%.+]] = fptosi x86_fp80 [[DIV]] to i64
|
||||
// CHECK: [[BF_LD:%.+]] = load i64, i64* [[TEMP]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i64, i64* [[TEMP1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i64 [[CONV]], 127
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i64 [[BF_AND:%.+]], 17
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i64 [[BF_LD]], -16646145
|
||||
// CHECK: [[VAL:%.+]] = or i64 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i64 [[VAL]], i64* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[LDTEMP]]
|
||||
// CHECK: store i64 [[VAL]], i64* [[TEMP1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[TEMP1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
|
@ -1010,6 +877,8 @@ int main() {
|
|||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i8 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST1:%.+]] = bitcast i64* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST1]],
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i64* %{{.+}} to i8*
|
||||
// CHECK: store i8 [[OLD_BF_VALUE]], i8* [[BITCAST]],
|
||||
// CHECK: [[A_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
|
@ -1019,13 +888,13 @@ int main() {
|
|||
// CHECK: [[ADD:%.+]] = fadd x86_fp80 [[CONV]], [[EXPR]]
|
||||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 [[ADD]] to i64
|
||||
// CHECK: [[TRUNC:%.+]] = trunc i64 [[NEW_VAL]] to i8
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST]],
|
||||
// CHECK: [[BF_LD:%.+]] = load i8, i8* [[BITCAST1]],
|
||||
// CHECK: [[BF_AND:%.+]] = and i8 [[TRUNC]], 127
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i8 [[BF_AND]], 1
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i8 [[BF_LD]], 1
|
||||
// CHECK: or i8 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[LDTEMP]]
|
||||
// CHECK: store i8 %{{.+}}, i8* [[BITCAST1]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[BITCAST1]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] monotonic monotonic
|
||||
// CHECK: [[FAILED_OLD_VAL]] = extractvalue { i8, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i8, i1 } [[RES]], 1
|
||||
|
@ -1036,24 +905,23 @@ int main() {
|
|||
// CHECK: load i64, i64*
|
||||
// CHECK: [[EXPR:%.+]] = uitofp i64 %{{.+}} to float
|
||||
// CHECK: [[I64VAL:%.+]] = load atomic i64, i64* bitcast (<2 x float>* [[DEST:@.+]] to i64*) monotonic
|
||||
// CHECK: [[LD:%.+]] = bitcast i64 [[I64VAL]] to <2 x float>
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = phi <2 x float> [ [[LD]], %{{.+}} ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[OLD_I64:%.+]] = phi i64 [ [[I64VAL]], %{{.+}} ], [ [[FAILED_I64_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast <2 x float>* [[TEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD_I64]], i64* [[BITCAST]],
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = bitcast i64 [[OLD_I64]] to <2 x float>
|
||||
// CHECK: store <2 x float> [[OLD_VEC_VAL]], <2 x float>* [[LDTEMP:%.+]],
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[X:%.+]] = extractelement <2 x float> [[VEC_VAL]], i64 0
|
||||
// CHECK: [[VEC_ITEM_VAL:%.+]] = fsub float [[EXPR]], [[X]]
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[LDTEMP]],
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[TEMP]],
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = insertelement <2 x float> [[VEC_VAL]], float [[VEC_ITEM_VAL]], i64 0
|
||||
// CHECK: store <2 x float> [[NEW_VEC_VAL]], <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[OLD_I64:%.+]] = bitcast <2 x float> [[OLD_VEC_VAL]] to i64
|
||||
// CHECK: [[NEW_I64:%.+]] = bitcast <2 x float> [[NEW_VEC_VAL]] to i64
|
||||
// CHECK: store <2 x float> [[NEW_VEC_VAL]], <2 x float>* [[TEMP]]
|
||||
// CHECK: [[NEW_I64:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (<2 x float>* [[DEST]] to i64*), i64 [[OLD_I64]], i64 [[NEW_I64]] monotonic monotonic
|
||||
// CHECK: [[FAILED_I64_OLD_VAL:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
// CHECK: [[FAILED_OLD_VAL]] = bitcast i64 [[FAILED_I64_OLD_VAL]] to <2 x float>
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic
|
||||
|
|
|
@ -265,21 +265,18 @@ int main() {
|
|||
// CHECK-DAG: load i8, i8*
|
||||
// CHECK-DAG: [[VEC_ITEM_VAL:%.+]] = zext i1 %{{.+}} to i32
|
||||
// CHECK: [[I128VAL:%.+]] = load atomic i128, i128* bitcast (<4 x i32>* [[DEST:@.+]] to i128*) monotonic
|
||||
// CHECK: [[LD:%.+]] = bitcast i128 [[I128VAL]] to <4 x i32>
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = phi <4 x i32> [ [[LD]], %{{.+}} ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store <4 x i32> [[OLD_VEC_VAL]], <4 x i32>* [[LDTEMP:%.+]],
|
||||
// CHECK: [[OLD_I128:%.+]] = phi i128 [ [[I128VAL]], %{{.+}} ], [ [[FAILED_I128_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast <4 x i32>* [[LDTEMP:%.+]] to i128*
|
||||
// CHECK: store i128 [[OLD_I128]], i128* [[BITCAST]],
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = insertelement <4 x i32> [[VEC_VAL]], i32 [[VEC_ITEM_VAL]], i16 [[IDX]]
|
||||
// CHECK: store <4 x i32> [[NEW_VEC_VAL]], <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = load <4 x i32>, <4 x i32>* [[LDTEMP]]
|
||||
// CHECK: [[OLD_I128:%.+]] = bitcast <4 x i32> [[OLD_VEC_VAL]] to i128
|
||||
// CHECK: [[NEW_I128:%.+]] = bitcast <4 x i32> [[NEW_VEC_VAL]] to i128
|
||||
// CHECK: [[NEW_I128:%.+]] = load i128, i128* [[BITCAST]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i128* bitcast (<4 x i32>* [[DEST]] to i128*), i128 [[OLD_I128]], i128 [[NEW_I128]] monotonic monotonic
|
||||
// CHECK: [[FAILED_I128_OLD_VAL:%.+]] = extractvalue { i128, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i128, i1 } [[RES]], 1
|
||||
// CHECK: [[FAILED_OLD_VAL]] = bitcast i128 [[FAILED_I128_OLD_VAL]] to <4 x i32>
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic write
|
||||
|
@ -306,21 +303,18 @@ int main() {
|
|||
// CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 %{{.+}} to i32
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i32* [[LDTEMP:%.+]] to i8*
|
||||
// CHECK: call void @__atomic_load(i64 4, i8* getelementptr (i8, i8* bitcast (%struct.BitFields_packed* @{{.+}} to i8*), i64 4), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i32 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]],
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[LDTEMP1:%.+]],
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP1]],
|
||||
// CHECK: [[BF_VALUE:%.+]] = and i32 [[NEW_VAL]], 2147483647
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 %{{.+}}, -2147483648
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i32 [[OLD_BF_VALUE]], -2147483648
|
||||
// CHECK: or i32 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i32, i32* [[LDTEMP]]
|
||||
// CHECK: store i32 [[OLD_BF_VALUE]], i32* [[TEMP_OLD_BF_ADDR:%.+]],
|
||||
// CHECK: store i32 [[NEW_BF_VALUE]], i32* [[TEMP_NEW_BF_ADDR:%.+]],
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* [[TEMP_OLD_BF_ADDR]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* [[TEMP_NEW_BF_ADDR]] to i8*
|
||||
// CHECK: store i32 %{{.+}}, i32* [[LDTEMP1]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* [[LDTEMP]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* [[LDTEMP1]] to i8*
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 4, i8* getelementptr (i8, i8* bitcast (%struct.BitFields_packed* @{{.+}} to i8*), i64 4), i8* [[BITCAST_TEMP_OLD_BF_ADDR]], i8* [[BITCAST_TEMP_NEW_BF_ADDR]], i32 0, i32 0)
|
||||
// CHECK: [[FAILED_OLD_VAL]] = load i32, i32* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic write
|
||||
|
@ -388,25 +382,19 @@ int main() {
|
|||
// CHECK: [[LDTEMP:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast i24* %{{.+}} to i8*
|
||||
// CHECK: call void @__atomic_load(i64 3, i8* getelementptr (i8, i8* bitcast (%struct.BitFields3_packed* @{{.+}} to i8*), i64 1), i8* [[BITCAST]], i32 0)
|
||||
// CHECK: [[PREV_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_BF_VALUE:%.+]] = phi i24 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[OLD_VAL:%.+]] = load i24, i24* %{{.+}},
|
||||
// CHECK: store i24 [[OLD_VAL]], i24* [[TEMP:%.+]],
|
||||
// CHECK: [[TRUNC:%.+]] = trunc i32 [[NEW_VAL]] to i24
|
||||
// CHECK: [[BF_AND:%.+]] = and i24 [[TRUNC]], 16383
|
||||
// CHECK: [[BF_VALUE:%.+]] = shl i24 [[BF_AND]], 3
|
||||
// CHECK: [[BF_CLEAR:%.+]] = and i24 %{{.+}}, -131065
|
||||
// CHECK: or i24 [[BF_CLEAR]], [[BF_VALUE]]
|
||||
// CHECK: store i24 %{{.+}}, i24* [[LDTEMP:%.+]]
|
||||
// CHECK: [[NEW_BF_VALUE:%.+]] = load i24, i24* [[LDTEMP]]
|
||||
// CHECK: [[TEMP_OLD_BF_ADDR:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: store i24 [[OLD_BF_VALUE]], i24* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: [[TEMP_NEW_BF_ADDR:%.+]] = bitcast i32* %{{.+}} to i24*
|
||||
// CHECK: store i24 [[NEW_BF_VALUE]], i24* [[TEMP_NEW_BF_ADDR]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i24* [[TEMP_OLD_BF_ADDR]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i24* [[TEMP_NEW_BF_ADDR]] to i8*
|
||||
// CHECK: store i24 %{{.+}}, i24* [[TEMP]]
|
||||
// CHECK: [[BITCAST_TEMP_OLD_BF_ADDR:%.+]] = bitcast i24* [[LDTEMP]] to i8*
|
||||
// CHECK: [[BITCAST_TEMP_NEW_BF_ADDR:%.+]] = bitcast i24* [[TEMP]] to i8*
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = call zeroext i1 @__atomic_compare_exchange(i64 3, i8* getelementptr (i8, i8* bitcast (%struct.BitFields3_packed* @{{.+}} to i8*), i64 1), i8* [[BITCAST_TEMP_OLD_BF_ADDR]], i8* [[BITCAST_TEMP_NEW_BF_ADDR]], i32 0, i32 0)
|
||||
// CHECK: [[FAILED_OLD_VAL]] = load i24, i24* [[TEMP_OLD_BF_ADDR]]
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic write
|
||||
|
@ -492,21 +480,18 @@ int main() {
|
|||
// CHECK: load i64, i64*
|
||||
// CHECK: [[VEC_ITEM_VAL:%.+]] = uitofp i64 %{{.+}} to float
|
||||
// CHECK: [[I64VAL:%.+]] = load atomic i64, i64* bitcast (<2 x float>* [[DEST:@.+]] to i64*) monotonic
|
||||
// CHECK: [[LD:%.+]] = bitcast i64 [[I64VAL]] to <2 x float>
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[OLD_VEC_VAL:%.+]] = phi <2 x float> [ [[LD]], %{{.+}} ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: store <2 x float> [[OLD_VEC_VAL]], <2 x float>* [[LDTEMP:%.+]],
|
||||
// CHECK: [[OLD_I64:%.+]] = phi i64 [ [[I64VAL]], %{{.+}} ], [ [[FAILED_I64_OLD_VAL:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[BITCAST:%.+]] = bitcast <2 x float>* [[LDTEMP:%.+]] to i64*
|
||||
// CHECK: store i64 [[OLD_I64]], i64* [[BITCAST]],
|
||||
// CHECK: [[VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = insertelement <2 x float> [[VEC_VAL]], float [[VEC_ITEM_VAL]], i64 0
|
||||
// CHECK: store <2 x float> [[NEW_VEC_VAL]], <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[NEW_VEC_VAL:%.+]] = load <2 x float>, <2 x float>* [[LDTEMP]]
|
||||
// CHECK: [[OLD_I64:%.+]] = bitcast <2 x float> [[OLD_VEC_VAL]] to i64
|
||||
// CHECK: [[NEW_I64:%.+]] = bitcast <2 x float> [[NEW_VEC_VAL]] to i64
|
||||
// CHECK: [[NEW_I64:%.+]] = load i64, i64* [[BITCAST]]
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (<2 x float>* [[DEST]] to i64*), i64 [[OLD_I64]], i64 [[NEW_I64]] monotonic monotonic
|
||||
// CHECK: [[FAILED_I64_OLD_VAL:%.+]] = extractvalue { i64, i1 } [[RES]], 0
|
||||
// CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1
|
||||
// CHECK: [[FAILED_OLD_VAL]] = bitcast i64 [[FAILED_I64_OLD_VAL]] to <2 x float>
|
||||
// CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]]
|
||||
// CHECK: [[EXIT]]
|
||||
#pragma omp atomic write
|
||||
|
|
|
@ -306,19 +306,16 @@ int main() {
|
|||
// t_var += t_var_reduction;
|
||||
// CHECK: load float, float* [[T_VAR_PRIV]]
|
||||
// CHECK: [[T_VAR_REF_INT:%.+]] = bitcast float* [[T_VAR_REF]] to i32*
|
||||
// CHECK: load atomic i32, i32* [[T_VAR_REF_INT]] monotonic,
|
||||
// CHECK: [[OLD1:%.+]] = bitcast i32 %{{.+}} to float
|
||||
// CHECK: [[OLD1:%.+]] = load atomic i32, i32* [[T_VAR_REF_INT]] monotonic,
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[ORIG_OLD:%.+]] = phi float [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[UP:%.+]] = fadd float
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = bitcast float [[ORIG_OLD]] to i32
|
||||
// CHECK: [[UP_INT:%.+]] = bitcast float [[UP]] to i32
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = phi i32 [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %[[CONT]] ]
|
||||
// CHECK: fadd float
|
||||
// CHECK: [[UP_INT:%.+]] = load i32, i32*
|
||||
// CHECK: [[T_VAR_REF_INT:%.+]] = bitcast float* [[T_VAR_REF]] to i32*
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[T_VAR_REF_INT]], i32 [[ORIG_OLD_INT]], i32 [[UP_INT]] monotonic monotonic
|
||||
// CHECK: [[OLD_VAL_INT:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[OLD2:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD2]] = bitcast i32 [[OLD_VAL_INT]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[ATOMIC_DONE:.+]], label %[[CONT]]
|
||||
// CHECK: [[ATOMIC_DONE]]
|
||||
|
||||
|
@ -351,21 +348,18 @@ int main() {
|
|||
// t_var1 = min(t_var1, t_var1_reduction);
|
||||
// CHECK: load float, float* [[T_VAR1_PRIV]]
|
||||
// CHECK: [[T_VAR1_REF_INT:%.+]] = bitcast float* [[T_VAR1_REF]] to i32*
|
||||
// CHECK: load atomic i32, i32* [[T_VAR1_REF_INT]] monotonic,
|
||||
// CHECK: [[OLD1:%.+]] = bitcast i32 %{{.+}} to float
|
||||
// CHECK: [[OLD1:%.+]] = load atomic i32, i32* [[T_VAR1_REF_INT]] monotonic,
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[ORIG_OLD:%.+]] = phi float [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %{{.+}} ]
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = phi i32 [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %{{.+}} ]
|
||||
// CHECK: [[CMP:%.+]] = fcmp olt float
|
||||
// CHECK: br i1 [[CMP]]
|
||||
// CHECK: [[UP:%.+]] = phi float
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = bitcast float [[ORIG_OLD]] to i32
|
||||
// CHECK: [[UP_INT:%.+]] = bitcast float [[UP]] to i32
|
||||
// CHECK: phi float
|
||||
// CHECK: [[UP_INT:%.+]] = load i32
|
||||
// CHECK: [[T_VAR1_REF_INT:%.+]] = bitcast float* [[T_VAR1_REF]] to i32*
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[T_VAR1_REF_INT]], i32 [[ORIG_OLD_INT]], i32 [[UP_INT]] monotonic monotonic
|
||||
// CHECK: [[OLD_VAL_INT:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[OLD2:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD2]] = bitcast i32 [[OLD_VAL_INT]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[ATOMIC_DONE:.+]], label %[[CONT]]
|
||||
// CHECK: [[ATOMIC_DONE]]
|
||||
|
||||
|
|
|
@ -298,19 +298,16 @@ int main() {
|
|||
// t_var += t_var_reduction;
|
||||
// CHECK: load float, float* [[T_VAR_PRIV]]
|
||||
// CHECK: [[T_VAR_REF_INT:%.+]] = bitcast float* [[T_VAR_REF]] to i32*
|
||||
// CHECK: load atomic i32, i32* [[T_VAR_REF_INT]] monotonic,
|
||||
// CHECK: [[OLD1:%.+]] = bitcast i32 %{{.+}} to float
|
||||
// CHECK: [[OLD1:%.+]] = load atomic i32, i32* [[T_VAR_REF_INT]] monotonic,
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[ORIG_OLD:%.+]] = phi float [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %[[CONT]] ]
|
||||
// CHECK: [[UP:%.+]] = fadd float
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = bitcast float [[ORIG_OLD]] to i32
|
||||
// CHECK: [[UP_INT:%.+]] = bitcast float [[UP]] to i32
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = phi i32 [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %[[CONT]] ]
|
||||
// CHECK: fadd float
|
||||
// CHECK: [[UP_INT:%.+]] = load i32
|
||||
// CHECK: [[T_VAR_REF_INT:%.+]] = bitcast float* [[T_VAR_REF]] to i32*
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[T_VAR_REF_INT]], i32 [[ORIG_OLD_INT]], i32 [[UP_INT]] monotonic monotonic
|
||||
// CHECK: [[OLD_VAL_INT:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[OLD2:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD2]] = bitcast i32 [[OLD_VAL_INT]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[ATOMIC_DONE:.+]], label %[[CONT]]
|
||||
// CHECK: [[ATOMIC_DONE]]
|
||||
|
||||
|
@ -343,21 +340,18 @@ int main() {
|
|||
// t_var1 = min(t_var1, t_var1_reduction);
|
||||
// CHECK: load float, float* [[T_VAR1_PRIV]]
|
||||
// CHECK: [[T_VAR1_REF_INT:%.+]] = bitcast float* [[T_VAR1_REF]] to i32*
|
||||
// CHECK: load atomic i32, i32* [[T_VAR1_REF_INT]] monotonic,
|
||||
// CHECK: [[OLD1:%.+]] = bitcast i32 %{{.+}} to float
|
||||
// CHECK: [[OLD1:%.+]] = load atomic i32, i32* [[T_VAR1_REF_INT]] monotonic,
|
||||
// CHECK: br label %[[CONT:.+]]
|
||||
// CHECK: [[CONT]]
|
||||
// CHECK: [[ORIG_OLD:%.+]] = phi float [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %{{.+}} ]
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = phi i32 [ [[OLD1]], %{{.+}} ], [ [[OLD2:%.+]], %{{.+}} ]
|
||||
// CHECK: [[CMP:%.+]] = fcmp olt float
|
||||
// CHECK: br i1 [[CMP]]
|
||||
// CHECK: [[UP:%.+]] = phi float
|
||||
// CHECK: [[ORIG_OLD_INT:%.+]] = bitcast float [[ORIG_OLD]] to i32
|
||||
// CHECK: [[UP_INT:%.+]] = bitcast float [[UP]] to i32
|
||||
// CHECK: [[UP_INT:%.+]] = load i32
|
||||
// CHECK: [[T_VAR1_REF_INT:%.+]] = bitcast float* [[T_VAR1_REF]] to i32*
|
||||
// CHECK: [[RES:%.+]] = cmpxchg i32* [[T_VAR1_REF_INT]], i32 [[ORIG_OLD_INT]], i32 [[UP_INT]] monotonic monotonic
|
||||
// CHECK: [[OLD_VAL_INT:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[OLD2:%.+]] = extractvalue { i32, i1 } [[RES]], 0
|
||||
// CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i32, i1 } [[RES]], 1
|
||||
// CHECK: [[OLD2]] = bitcast i32 [[OLD_VAL_INT]] to float
|
||||
// CHECK: br i1 [[SUCCESS_FAIL]], label %[[ATOMIC_DONE:.+]], label %[[CONT]]
|
||||
// CHECK: [[ATOMIC_DONE]]
|
||||
|
||||
|
|
Loading…
Reference in New Issue