summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-09-25 15:58:36 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-07 15:00:20 -0400
commitb41f7c3814b2e0e765311babc851cd3d9b6a78d8 (patch)
treeff0dd8327fb48f68e5351cb8501d4bac16c32668 /compiler/GHC/CmmToAsm
parent5fc4243bf2da2adbae3d01d163053e8895bc52d9 (diff)
downloadhaskell-b41f7c3814b2e0e765311babc851cd3d9b6a78d8.tar.gz
WinIO: Small changes related to atomic request swaps.
Move the atomix exchange over the Ptr type to an internal module. Fix a bug caused by us passing ptr-to-ptr instead of ptr to atomic exchange. Renamed interlockedExchange to exchangePtr. I've also added an cas primitive. It turned out we don't need it for WinIO but I'm leaving it in as it's useful for other things.
Diffstat (limited to 'compiler/GHC/CmmToAsm')
-rw-r--r--compiler/GHC/CmmToAsm/X86/CodeGen.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
index e9b54c6b45..aa4769f376 100644
--- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
@@ -2561,6 +2561,8 @@ genCCall' config is32Bit (PrimTarget (MO_Xchg width)) [dst] [addr, value] _
-- Copy the value into the target register, perform the exchange.
let code = toOL
[ MOV format (OpReg newval) (OpReg dst_r)
+ -- On X86 xchg implies a lock prefix if we use a memory argument.
+ -- so this is atomic.
, XCHG format (OpAddr amode) dst_r
]
return $ addr_code `appOL` newval_code `appOL` code