summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2019-01-22 05:06:57 +0000
committerAlex Bradbury <asb@lowrisc.org>2019-01-22 05:06:57 +0000
commitb96b755c4da5c10fa134ec7c40b0014c0edf204d (patch)
tree472dc9ce907126c5e0f1b3e0a5a842bb172a77c1 /llvm/lib/Target/RISCV/RISCVISelLowering.cpp
parent06bb373559a6014af36b7122b4a7048905a17166 (diff)
downloadbcm5719-llvm-b96b755c4da5c10fa134ec7c40b0014c0edf204d.tar.gz
bcm5719-llvm-b96b755c4da5c10fa134ec7c40b0014c0edf204d.zip
[RISCV] Fix build after r351778
Also add a comment to explain the expansion strategy for atomicrmw {fadd,fsub}. llvm-svn: 351782
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelLowering.cpp')
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelLowering.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index f70ffaab0c1..b9e23df428e 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud