summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-22 18:18:02 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-22 18:18:02 +0000
commit39508331ef7e9417afc43f634c0ef23eb768d974 (patch)
tree37138807947246687637b0b5eccc66f6b5b9ed61 /llvm/lib/Target/RISCV/RISCVISelLowering.cpp
parent1c5d23f1405994da05697b3b66c9f5a32735fdc3 (diff)
downloadbcm5719-llvm-39508331ef7e9417afc43f634c0ef23eb768d974.tar.gz
bcm5719-llvm-39508331ef7e9417afc43f634c0ef23eb768d974.zip
Reapply "IR: Add fp operations to atomicrmw"
This reapplies commits r351778 and r351782 with RISCV test fixes. llvm-svn: 351850
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVISelLowering.cpp')
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelLowering.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 95943f3dbaf..16591c4208c 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1724,6 +1724,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 breaking the
+ // forward-progress guarantee.
+ if (AI->isFloatingPointOperation())
+ return AtomicExpansionKind::CmpXChg;
+
unsigned Size = AI->getType()->getPrimitiveSizeInBits();
if (Size == 8 || Size == 16)
return AtomicExpansionKind::MaskedIntrinsic;
OpenPOWER on IntegriCloud