diff options
author | Viktor Dukhovni <ietf-dane@dukhovni.org> | 2020-10-05 01:43:26 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-05 00:50:23 -0500 |
commit | 17d5c51834d64f1762320b7abaa40c5686564f4d (patch) | |
tree | 0b7c681aa2968eb8611890868f69e57dde89ffd7 /testsuite/tests/codeGen/should_compile | |
parent | 81560981fd9af7ea21b2592c405e9e22af838aab (diff) | |
download | haskell-17d5c51834d64f1762320b7abaa40c5686564f4d.tar.gz |
Naming, value types and tests for Addr# atomics
The atomic Exchange and CAS operations on integral types are updated to
take and return more natural `Word#` rather than `Int#` values. These
are bit-block not arithmetic operations, and the sign bit plays no
special role.
Standardises the names to `atomic<OpType><ValType>Addr#`, where `OpType` is one
of `Cas` or `Exchange` and `ValType` is presently either `Word` or `Addr`.
Eventually, variants for `Word32` and `Word64` can and should be added,
once #11953 and related issues (e.g. #13825) are resolved.
Adds tests for `Addr#` CAS that mirror existing tests for
`MutableByteArray#`.
Diffstat (limited to 'testsuite/tests/codeGen/should_compile')
-rw-r--r-- | testsuite/tests/codeGen/should_compile/cg011.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/codeGen/should_compile/cg011.hs b/testsuite/tests/codeGen/should_compile/cg011.hs index 5d86621784..09e5497d61 100644 --- a/testsuite/tests/codeGen/should_compile/cg011.hs +++ b/testsuite/tests/codeGen/should_compile/cg011.hs @@ -4,8 +4,8 @@ module M where -import GHC.Exts (atomicExchangeInt#, Int#, Addr#, State# ) +import GHC.Exts (atomicExchangeWordAddr#, Word#, Addr#, State# ) -swap :: Addr# -> Int# -> State# s -> (# #) -swap ptr val s = case (atomicExchangeInt# ptr val s) of +swap :: Addr# -> Word# -> State# s -> (# #) +swap ptr val s = case (atomicExchangeWordAddr# ptr val s) of (# s2, old_val #) -> (# #) |