[commit: testsuite] master: Add tests for prefetch primops (#8256) (14b1439)
git at git.haskell.org
git
Wed Oct 2 05:55:37 UTC 2013
Repository : ssh://git at git.haskell.org/testsuite
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/14b14399f1b5189e9d18c9ddc9c6909c781af4af/testsuite
>---------------------------------------------------------------
commit 14b14399f1b5189e9d18c9ddc9c6909c781af4af
Author: Austin Seipp <austin at well-typed.com>
Date: Tue Oct 1 21:20:24 2013 -0500
Add tests for prefetch primops (#8256)
Authored-by: Carter Tazio Schonwald <carter.schonwald at gmail.com>
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
14b14399f1b5189e9d18c9ddc9c6909c781af4af
tests/codeGen/should_run/T8256.hs | 48 +++++++++++++++++++++++++++++++++
tests/codeGen/should_run/T8256.stdout | 1 +
tests/codeGen/should_run/all.T | 1 +
3 files changed, 50 insertions(+)
diff --git a/tests/codeGen/should_run/T8256.hs b/tests/codeGen/should_run/T8256.hs
new file mode 100644
index 0000000..7f8314c
--- /dev/null
+++ b/tests/codeGen/should_run/T8256.hs
@@ -0,0 +1,48 @@
+{-# LANGUAGE MagicHash, UnboxedTuples #-}
+
+
+
+import GHC.Prim
+
+import Data.Vector.Storable.Mutable
+import Foreign.Ptr
+import GHC.ST
+import Data.Primitive.ByteArray
+import Control.Monad.Primitive
+
+
+
+sameByteArray :: Control.Monad.Primitive.PrimMonad m => ByteArray -> ByteArray -> m Bool
+sameByteArray ar1 ar2 =
+ do v1 <- unsafeThawByteArray ar1
+ v2 <- unsafeThawByteArray ar2
+ return $ sameMutableByteArray v1 v2
+
+pf0 (ByteArray by) = ByteArray ( prefetchByteArray0# by 1#)
+
+pf1 (ByteArray by) = ByteArray (prefetchByteArray1# by 1#)
+
+pf2 (ByteArray by) = ByteArray ( prefetchByteArray2# by 1#)
+
+pf3 (ByteArray by) = ByteArray ( prefetchByteArray3# by 1#)
+
+
+monoSame v f = sameByteArray v (f v)
+
+
+
+
+main :: IO ()
+main = do
+ mv1 <- newByteArray 17
+ v1 <- unsafeFreezeByteArray mv1
+ return ()
+ t0<- monoSame v1 pf0
+ t1 <- monoSame v1 pf1
+ t2 <- monoSame v1 pf2
+ t3 <- monoSame v1 pf3
+ if t0 && t1 && t2 && t3 then putStrLn "success" else error "bad prefetch operation! please report"
+
+
+
+
diff --git a/tests/codeGen/should_run/T8256.stdout b/tests/codeGen/should_run/T8256.stdout
new file mode 100644
index 0000000..2e9ba47
--- /dev/null
+++ b/tests/codeGen/should_run/T8256.stdout
@@ -0,0 +1 @@
+success
diff --git a/tests/codeGen/should_run/all.T b/tests/codeGen/should_run/all.T
index 46cddbb..f7b36ff 100644
--- a/tests/codeGen/should_run/all.T
+++ b/tests/codeGen/should_run/all.T
@@ -114,3 +114,4 @@ test('T7361', normal, compile_and_run, [''])
test('T7600', normal, compile_and_run, [''])
test('T8103', only_ways(['normal']), compile_and_run, [''])
test('T7953', reqlib('random'), compile_and_run, [''])
+test('T8256',normal, compile_and_run, [''])
More information about the ghc-commits
mailing list