From: Alex Bradbury Date: Tue, 22 Jan 2019 05:06:57 +0000 (+0000) Subject: [RISCV] Fix build after r351778 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8bd282da5b5dc104d74e9e867d349f9ddb8d06a;p=llvm [RISCV] Fix build after r351778 Also add a comment to explain the expansion strategy for atomicrmw {fadd,fsub}. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351782 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/RISCV/RISCVISelLowering.cpp b/lib/Target/RISCV/RISCVISelLowering.cpp index f70ffaab0c1..b9e23df428e 100644 --- a/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/lib/Target/RISCV/RISCVISelLowering.cpp @@ -1720,6 +1720,12 @@ Instruction *RISCVTargetLowering::emitTrailingFence(IRBuilder<> &Builder, TargetLowering::AtomicExpansionKind RISCVTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const { + // atomicrmw {fadd,fsub} must be expanded to use compare-exchange, as + // floating point operations can't be used in an lr/sc sequence without + // brekaing the forward-progress guarantee. + if (AI->isFloatingPointOperation()) + return AtomicExpansionKind::CmpXChg; + unsigned Size = AI->getType()->getPrimitiveSizeInBits(); if (Size == 8 || Size == 16) return AtomicExpansionKind::MaskedIntrinsic; @@ -1823,9 +1829,6 @@ Value *RISCVTargetLowering::emitMaskedAtomicRMWIntrinsic( TargetLowering::AtomicExpansionKind RISCVTargetLowering::shouldExpandAtomicCmpXchgInIR( AtomicCmpXchgInst *CI) const { - if (CI->isFloatingPointOperation()) - return AtomicExpansionKind::CmpXChg; - unsigned Size = CI->getCompareOperand()->getType()->getPrimitiveSizeInBits(); if (Size == 8 || Size == 16) return AtomicExpansionKind::MaskedIntrinsic;