From c0e6dee99242eff08420176a36d77b715972f1f2 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Sat, 1 Jun 2019 11:20:39 +0100 Subject: winio: Add Atomic Exchange PrimOp and implement Atomic Ptr exchanges. The initial version was rewritten by Tamar Christina. It was rewritten in large parts by Andreas Klebinger. Co-authored-by: Andreas Klebinger --- compiler/GHC/StgToCmm/Prim.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/GHC/StgToCmm') diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs index e70f50ee84..fee96f31f8 100644 --- a/compiler/GHC/StgToCmm/Prim.hs +++ b/compiler/GHC/StgToCmm/Prim.hs @@ -856,6 +856,12 @@ emitPrimOp dflags = \case Word2DoubleOp -> \[w] -> opAllDone $ \[res] -> do emitPrimCall [res] (MO_UF_Conv W64) [w] +-- Atomic operations + InterlockedExchange_Addr -> \[src, value] -> opAllDone $ \[res] -> + emitPrimCall [res] (MO_Xchg (wordWidth platform)) [src, value] + InterlockedExchange_Int -> \[src, value] -> opAllDone $ \[res] -> + emitPrimCall [res] (MO_Xchg (wordWidth platform)) [src, value] + -- SIMD primops (VecBroadcastOp vcat n w) -> \[e] -> opAllDone $ \[res] -> do checkVecCompatibility dflags vcat n w -- cgit v1.2.1