summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-05-17 19:05:26 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-18 22:02:22 +0200
commit310371ff2d5b73cdcb2439b67170ca5e613541c0 (patch)
treec447b75f3ea056381cc3282fa81704907cd616c9 /testsuite/tests/codeGen
parent39a2faa05fbbdb4a5ef0682afc42b5809cbd86ce (diff)
downloadhaskell-310371ff2d5b73cdcb2439b67170ca5e613541c0.tar.gz
rts: Add isPinnedByteArray# primop
Adds a primitive operation to determine whether a particular `MutableByteArray#` is backed by a pinned buffer. Test Plan: Validate with included testcase Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2217 GHC Trac Issues: #12059
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_run/T12059.hs27
-rw-r--r--testsuite/tests/codeGen/should_run/T12059.stdout3
-rw-r--r--testsuite/tests/codeGen/should_run/all.T1
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T12059.hs b/testsuite/tests/codeGen/should_run/T12059.hs
new file mode 100644
index 0000000000..0b99bd36a4
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T12059.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedTuples #-}
+
+-- Test the function of the isPinnedByteArray# primop
+
+import GHC.Exts
+import GHC.IO
+
+main :: IO ()
+main = do
+ r <- IO $ \s0 ->
+ case newByteArray# 1024# s0 of
+ (# s1, mba #) ->
+ (# s1, isTrue# (isPinnedByteArray# mba) #)
+ print r
+
+ r <- IO $ \s0 ->
+ case newPinnedByteArray# 1024# s0 of
+ (# s1, mba #) ->
+ (# s1, isTrue# (isPinnedByteArray# mba) #)
+ print r
+
+ r <- IO $ \s0 ->
+ case newAlignedPinnedByteArray# 1024# 16# s0 of
+ (# s1, mba #) ->
+ (# s1, isTrue# (isPinnedByteArray# mba) #)
+ print r
diff --git a/testsuite/tests/codeGen/should_run/T12059.stdout b/testsuite/tests/codeGen/should_run/T12059.stdout
new file mode 100644
index 0000000000..70cea9e2ea
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T12059.stdout
@@ -0,0 +1,3 @@
+False
+True
+True
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 1175f222e3..921f2c3aaa 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -140,3 +140,4 @@ test('T10521b', normal, compile_and_run, [''])
test('T10870', when(wordsize(32), skip), compile_and_run, [''])
test('PopCnt', omit_ways(['ghci']), multi_compile_and_run,
['PopCnt', [('PopCnt_cmm.cmm', '')], ''])
+test('T12059', normal, compile_and_run, [''])