summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_compile/cg011.hs
blob: 5d86621784678aeb098ea8c387f59451315d53b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
{-# LANGUAGE CPP, MagicHash, BlockArguments, UnboxedTuples #-}

-- Tests compilation for atomic exchange primop.

module M where

import GHC.Exts (atomicExchangeInt#, Int#, Addr#, State# )

swap :: Addr# -> Int# -> State# s -> (# #)
swap ptr val s = case (atomicExchangeInt# ptr val s) of
            (# s2, old_val #) -> (# #)