diff options
author | Tim Northover <tnorthover@apple.com> | 2013-07-03 09:20:36 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-07-03 09:20:36 +0000 |
commit | 36b2417f18f4b44d184cb54b5395d2f3e4397b18 (patch) | |
tree | 59f3b64f3d2727204b31ac7a40e988b42f8636f7 /llvm/lib/Target/ARM/ARMISelLowering.cpp | |
parent | df313ff6975ba4f902b5cb8a84b4998efe2cd173 (diff) | |
download | bcm5719-llvm-36b2417f18f4b44d184cb54b5395d2f3e4397b18.tar.gz bcm5719-llvm-36b2417f18f4b44d184cb54b5395d2f3e4397b18.zip |
ARM: relax the atomic release barrier to "dmb ishst" on Swift
Swift cores implement store barriers that are stronger than the ARM
specification but weaker than general barriers. They are, in fact, just about
enough to provide the ordering needed for atomic operations with release
semantics.
This patch makes use of that quirk.
llvm-svn: 185527
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index ff8571ba033..cc09754ef70 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -2557,8 +2557,18 @@ static SDValue LowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG, DAG.getConstant(0, MVT::i32)); } + ConstantSDNode *OrdN = cast<ConstantSDNode>(Op.getOperand(1)); + AtomicOrdering Ord = static_cast<AtomicOrdering>(OrdN->getZExtValue()); + unsigned Domain = ARM_MB::ISH; + if (Subtarget->isSwift() && Ord == Release) { + // Swift happens to implement ISHST barriers in a way that's compatible with + // Release semantics but weaker than ISH so we'd be fools not to use + // it. Beware: other processors probably don't! + Domain = ARM_MB::ISHST; + } + return DAG.getNode(ARMISD::MEMBARRIER, dl, MVT::Other, Op.getOperand(0), - DAG.getConstant(ARM_MB::ISH, MVT::i32)); + DAG.getConstant(Domain, MVT::i32)); } static SDValue LowerPREFETCH(SDValue Op, SelectionDAG &DAG, |