Skip to content

Commit bf31e46

Browse files
committed
Check soft float
1 parent 665d84c commit bf31e46

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27098,15 +27098,17 @@ AArch64TargetLowering::shouldExpandAtomicLoadInIR(LoadInst *LI) const {
2709827098

2709927099
// Return true if the atomic operation expansion will lower to use a library
2710027100
// call, and is thus ineligible to use an LLSC expansion.
27101-
static bool rmwOpMayLowerToLibcall(const AtomicRMWInst *RMW) {
27101+
static bool rmwOpMayLowerToLibcall(const AArch64Subtarget &Subtarget,
27102+
const AtomicRMWInst *RMW) {
2710227103
if (!RMW->isFloatingPointOperation())
2710327104
return false;
2710427105
switch (RMW->getType()->getScalarType()->getTypeID()) {
2710527106
case Type::FloatTyID:
2710627107
case Type::DoubleTyID:
2710727108
case Type::HalfTyID:
2710827109
case Type::BFloatTyID:
27109-
return false;
27110+
// Will use soft float
27111+
return !Subtarget.hasFPARMv8();
2711027112
default:
2711127113
// fp128 will emit library calls.
2711227114
return true;
@@ -27161,7 +27163,7 @@ AArch64TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
2716127163
// succeed. So at -O0 lower this operation to a CAS loop. Also worthwhile if
2716227164
// we have a single CAS instruction that can replace the loop.
2716327165
if (getTargetMachine().getOptLevel() == CodeGenOptLevel::None ||
27164-
Subtarget->hasLSE() || rmwOpMayLowerToLibcall(AI))
27166+
Subtarget->hasLSE() || rmwOpMayLowerToLibcall(*Subtarget, AI))
2716527167
return AtomicExpansionKind::CmpXChg;
2716627168

2716727169
return AtomicExpansionKind::LLSC;

0 commit comments

Comments
 (0)