Skip to content

Commit 5bed50c

Browse files
committed
Check soft float
1 parent 12ca53f commit 5bed50c

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
@@ -27069,15 +27069,17 @@ AArch64TargetLowering::shouldExpandAtomicLoadInIR(LoadInst *LI) const {
2706927069

2707027070
// Return true if the atomic operation expansion will lower to use a library
2707127071
// call, and is thus ineligible to use an LLSC expansion.
27072-
static bool rmwOpMayLowerToLibcall(const AtomicRMWInst *RMW) {
27072+
static bool rmwOpMayLowerToLibcall(const AArch64Subtarget &Subtarget,
27073+
const AtomicRMWInst *RMW) {
2707327074
if (!RMW->isFloatingPointOperation())
2707427075
return false;
2707527076
switch (RMW->getType()->getScalarType()->getTypeID()) {
2707627077
case Type::FloatTyID:
2707727078
case Type::DoubleTyID:
2707827079
case Type::HalfTyID:
2707927080
case Type::BFloatTyID:
27080-
return false;
27081+
// Will use soft float
27082+
return !Subtarget.hasFPARMv8();
2708127083
default:
2708227084
// fp128 will emit library calls.
2708327085
return true;
@@ -27132,7 +27134,7 @@ AArch64TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
2713227134
// succeed. So at -O0 lower this operation to a CAS loop. Also worthwhile if
2713327135
// we have a single CAS instruction that can replace the loop.
2713427136
if (getTargetMachine().getOptLevel() == CodeGenOptLevel::None ||
27135-
Subtarget->hasLSE() || rmwOpMayLowerToLibcall(AI))
27137+
Subtarget->hasLSE() || rmwOpMayLowerToLibcall(*Subtarget, AI))
2713627138
return AtomicExpansionKind::CmpXChg;
2713727139

2713827140
return AtomicExpansionKind::LLSC;

0 commit comments

Comments
 (0)