[llvm] r351782 - [RISCV] Fix build after r351778
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 21 21:06:57 PST 2019
Author: asb
Date: Mon Jan 21 21:06:57 2019
New Revision: 351782
URL: http://llvm.org/viewvc/llvm-project?rev=351782&view=rev
Log:
[RISCV] Fix build after r351778
Also add a comment to explain the expansion strategy for atomicrmw
{fadd,fsub}.
Modified:
llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
Modified: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp?rev=351782&r1=351781&r2=351782&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp Mon Jan 21 21:06:57 2019
@@ -1720,6 +1720,12 @@ Instruction *RISCVTargetLowering::emitTr
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::emitMaskedAt
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;
More information about the llvm-commits
mailing list