summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
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, [''])