Import uvector microbenchmarks for fusion
authorDon Stewart <dons@galois.com>
Mon, 15 Feb 2010 20:44:15 +0000 (20:44 +0000)
committerDon Stewart <dons@galois.com>
Mon, 15 Feb 2010 20:44:15 +0000 (20:44 +0000)
57 files changed:
old-testsuite/microsuite/README [new file with mode: 0644]
old-testsuite/microsuite/Test.hs [new file with mode: 0644]
old-testsuite/microsuite/and.hs [new file with mode: 0644]
old-testsuite/microsuite/append.hs [new file with mode: 0644]
old-testsuite/microsuite/cons.hs [new file with mode: 0644]
old-testsuite/microsuite/drop.hs [new file with mode: 0644]
old-testsuite/microsuite/elem.hs [new file with mode: 0644]
old-testsuite/microsuite/empty.hs [new file with mode: 0644]
old-testsuite/microsuite/eq.hs [new file with mode: 0644]
old-testsuite/microsuite/filter.hs [new file with mode: 0644]
old-testsuite/microsuite/find.hs [new file with mode: 0644]
old-testsuite/microsuite/findIndex.hs [new file with mode: 0644]
old-testsuite/microsuite/foldl1.hs [new file with mode: 0644]
old-testsuite/microsuite/from-to.hs [new file with mode: 0644]
old-testsuite/microsuite/head.hs [new file with mode: 0644]
old-testsuite/microsuite/index.hs [new file with mode: 0644]
old-testsuite/microsuite/init.hs [new file with mode: 0644]
old-testsuite/microsuite/last.hs [new file with mode: 0644]
old-testsuite/microsuite/length-bool.hs [new file with mode: 0644]
old-testsuite/microsuite/length-char.hs [new file with mode: 0644]
old-testsuite/microsuite/length-double.hs [new file with mode: 0644]
old-testsuite/microsuite/length-float.hs [new file with mode: 0644]
old-testsuite/microsuite/length-int16.hs [new file with mode: 0644]
old-testsuite/microsuite/length-int32.hs [new file with mode: 0644]
old-testsuite/microsuite/length-int64.hs [new file with mode: 0644]
old-testsuite/microsuite/length-int8.hs [new file with mode: 0644]
old-testsuite/microsuite/length-unit.hs [new file with mode: 0644]
old-testsuite/microsuite/length-word.hs [new file with mode: 0644]
old-testsuite/microsuite/length-word16.hs [new file with mode: 0644]
old-testsuite/microsuite/length-word32.hs [new file with mode: 0644]
old-testsuite/microsuite/length-word64.hs [new file with mode: 0644]
old-testsuite/microsuite/length-word8.hs [new file with mode: 0644]
old-testsuite/microsuite/length.hs [new file with mode: 0644]
old-testsuite/microsuite/lookup.hs [new file with mode: 0644]
old-testsuite/microsuite/map.hs [new file with mode: 0644]
old-testsuite/microsuite/maximum.hs [new file with mode: 0644]
old-testsuite/microsuite/maximumBy.hs [new file with mode: 0644]
old-testsuite/microsuite/minimum.hs [new file with mode: 0644]
old-testsuite/microsuite/minimumBy.hs [new file with mode: 0644]
old-testsuite/microsuite/null-ndp.hs [new file with mode: 0644]
old-testsuite/microsuite/null.hs [new file with mode: 0644]
old-testsuite/microsuite/or.hs [new file with mode: 0644]
old-testsuite/microsuite/product.hs [new file with mode: 0644]
old-testsuite/microsuite/repeat.hs [new file with mode: 0644]
old-testsuite/microsuite/replicate.hs [new file with mode: 0644]
old-testsuite/microsuite/singleton.hs [new file with mode: 0644]
old-testsuite/microsuite/snoc.hs [new file with mode: 0644]
old-testsuite/microsuite/sum-complex.hs [new file with mode: 0644]
old-testsuite/microsuite/sum-ratio.hs [new file with mode: 0644]
old-testsuite/microsuite/sum.hs [new file with mode: 0644]
old-testsuite/microsuite/tail.hs [new file with mode: 0644]
old-testsuite/microsuite/take.hs [new file with mode: 0644]
old-testsuite/microsuite/takeWhile.hs [new file with mode: 0644]
old-testsuite/microsuite/unfold.hs [new file with mode: 0644]
old-testsuite/microsuite/zip.hs [new file with mode: 0644]
old-testsuite/microsuite/zipwith.hs [new file with mode: 0644]
old-testsuite/microsuite/zipwith3.hs [new file with mode: 0644]

diff --git a/old-testsuite/microsuite/README b/old-testsuite/microsuite/README
new file mode 100644 (file)
index 0000000..1820766
--- /dev/null
@@ -0,0 +1,8 @@
+Here is a set of small programs useful for visually inspecting
+that fusion has worked. Many of them have decent runtimes that will
+explode if fusion fails.
+
+In addition, there is a script, ./Test, that will check the entire suite
+against expected rule firings.
+
+The Test.hs file will need to be updated if you add new fusion rules.
diff --git a/old-testsuite/microsuite/Test.hs b/old-testsuite/microsuite/Test.hs
new file mode 100644 (file)
index 0000000..3171f22
--- /dev/null
@@ -0,0 +1,200 @@
+{-# LANGUAGE CPP #-}
+
+#if __GLASGOW_HASKELL__  < 610
+import System.Process
+import qualified Control.Exception as C
+#else
+import System.Process hiding (readProcess)
+import qualified Control.OldException as C
+#endif
+
+import System.Exit
+import System.IO
+import Data.List
+import Data.Maybe
+import System.Directory
+
+import Control.Monad
+import Control.Concurrent
+import Text.Printf
+
+import Text.Regex.PCRE.Light.Char8
+
+------------------------------------------------------------------------
+
+flags= [["-O","-fspec-constr"]
+       ,["-O2"]
+       ]
+
+tests =
+    [(Just 2, "cons",                       flags )     -- expect 2 fusions, with -O2 and -O
+    ,(Just 2, "snoc",                       flags )
+    ,(Just 2, "empty",                      flags )
+--  ,(Just 1, "from-to",                    flags )
+    ,(Just 2, "singleton",                  flags )
+    ,(Just 4, "map",                        flags )
+    ,(Just 5, "filter",                     flags )
+    ,(Just 2, "replicate",                  flags )
+    ,(Just 2, "takeWhile",                  flags )
+    ,(Just 2, "index",                      flags )
+    ,(Just 3, "null",                       flags )
+    ,(Just 1, "length",                     flags )
+    ,(Just 1, "length-bool",                flags )
+    ,(Just 1, "length-unit",                flags )
+    ,(Just 1, "length-char",                flags )
+    ,(Just 1, "length-word",                flags )
+
+    ,(Just 1, "length-word8",                flags )
+    ,(Just 1, "length-word16",                flags )
+    ,(Just 1, "length-word32",                flags )
+    ,(Just 1, "length-word64",                flags )
+
+    ,(Just 1, "length-int8",                flags )
+    ,(Just 1, "length-int16",                flags )
+    ,(Just 1, "length-int32",                flags )
+    ,(Just 1, "length-int64",                flags )
+
+    ,(Just 1, "length-double",                flags )
+    ,(Just 1, "length-float",                flags )
+    ,(Just 1, "head",                       flags )
+    ,(Just 3, "append",                     flags )
+    ,(Just 2, "sum",                        flags )
+    ,(Just 3, "product",                    flags )
+    ,(Just 1, "and",                        flags )
+    ,(Just 1, "or",                         flags )
+    ,(Just 2, "elem",                         flags )
+    ,(Just 2, "tail",                         flags )
+    ,(Just 2, "find",                         flags )
+    ,(Just 2, "findIndex",                         flags )
+    ,(Just 2, "init",                         flags )
+    ,(Just 2, "last",                         flags )
+    ,(Just 3, "foldl1",                         flags )
+    ,(Just 3, "minimum",                         flags )
+    ,(Just 3, "maximum",                         flags )
+    ,(Just 3, "maximumBy",                         flags )
+    ,(Just 3, "minimumBy",                         flags )
+    ,(Just 2, "take",                         flags )
+    ,(Just 2, "drop",                         flags )
+    ,(Just 4, "zipwith",                         flags )
+    ,(Just 4, "zipwith3",                         flags )
+    ,(Just 3, "zip",                         flags ) -- expect zipU fusion
+    ]
+
+------------------------------------------------------------------------
+
+main = do
+    printf "Running %d fusion tests.\n" (length tests)
+    vs <- forM tests $ \x -> do v <- run x
+                                putChar '\n'
+                                return v
+    printf "\nDone.\n"
+    if not (and vs)
+       then exitWith (ExitFailure 1)
+       else return ()
+
+run :: (Maybe Int, String, [[String]]) -> IO Bool
+run (n, name, args) = do
+  printf "%20s: " name >> hFlush stdout
+  v <- forM args $ \opt -> do
+    putChar '.' >> hFlush stdout
+    (cmd,ex,fusion) <- compile_program name opt
+    if ex /= n
+       then do
+               printf "\n%s failed to trigger fusion. Expected %s, Actual %s.\n"
+                            name (show n) (show ex)
+               printf "Command line: %s\n" (show $ intercalate " " cmd)
+               return False
+       else
+         if isJust fusion
+            then do
+                   printf "\n%s failed to remove all vectors.\n" name
+                   printf "Remnants: %s\n" (show fusion)
+                   printf "Command line: %s\n" (show $ intercalate " " cmd)
+                   return False
+            else return True
+  return (and v)
+
+------------------------------------------------------------------------
+
+compile_program s opt = do
+
+    let command = [(s ++ ".hs"), "-ddump-simpl","-ddump-simpl-stats","-no-recomp","--make"] ++ opt
+    x <- readProcess "ghc" command [] 
+    removeFile s
+    case x of
+         Left (err,str) -> do
+            print str
+            printf "GHC failed to compile %s\n" s
+            exitWith (ExitFailure 1) -- fatal
+
+         Right str      -> do
+            return $ case match fusion_regex str [] of
+                          Nothing -> (command,Nothing,Nothing)
+                          Just xs -> {- trace (show xs) $ -}
+                               let fusion_result = (read . last $ xs)
+                               in case match left_over_vector str [] of
+                                     Nothing -> (command, Just fusion_result, Nothing)
+                                     Just n  -> (command, Just fusion_result, Just n)
+
+------------------------------------------------------------------------
+
+-- Fusion happened
+fusion_regex = compile "(\\d+).*(?:stream|length|head)/unstream" []
+
+-- Data.Array.Vector.Strict.Prim.UVec
+-- UVectors were left behind
+left_over_vector = compile "Data\\.Vector\\.Unboxed\\.Base\\.Vector" []
+
+------------------------------------------------------------------------
+
+-- Also, bytestring input/output, since we're strict
+-- Document that this isn't for interactive
+
+--
+-- | readProcess forks an external process, reads its standard output
+-- strictly, blocking until the process terminates, and returns either the output
+-- string, or, in the case of non-zero exit status, an error code, and
+-- any output.
+--
+-- Output is returned strictly, so this is not suitable for
+-- interactive applications.
+--
+-- Users of this library should compile with -threaded if they
+-- want other Haskell threads to keep running while waiting on
+-- the result of readProcess.
+--
+-- >  > readProcess "date" [] []
+-- >  Right "Thu Feb  7 10:03:39 PST 2008\n"
+--
+-- The argumenst are:
+--
+-- * The command to run, which must be in the $PATH, or an absolute path 
+--  
+-- * A list of separate command line arguments to the program
+--
+-- * A string to pass on the standard input to the program.
+--
+readProcess :: FilePath                     -- ^ command to run
+            -> [String]                     -- ^ any arguments
+            -> String                       -- ^ standard input
+            -> IO (Either (ExitCode,String) String)  -- ^ either the stdout, or an exitcode and any output
+
+readProcess cmd args input = C.handle (return . handler) $ do
+    (inh,outh,errh,pid) <- runInteractiveProcess cmd args Nothing Nothing
+    output  <- hGetContents outh
+    outMVar <- newEmptyMVar
+    forkIO $ (C.evaluate (length output) >> putMVar outMVar ())
+    when (not (null input)) $ hPutStr inh input
+    takeMVar outMVar
+    ex     <- C.catch (waitForProcess pid) (\_e -> return ExitSuccess)
+    hClose outh
+    hClose inh          -- done with stdin
+    hClose errh         -- ignore stderr
+
+    return $ case ex of
+        ExitSuccess   -> Right output
+        ExitFailure _ -> Left (ex, output)
+
+  where
+    handler (C.ExitException e) = Left (e,"")
+    handler e                   = Left (ExitFailure 1, show e)
diff --git a/old-testsuite/microsuite/and.hs b/old-testsuite/microsuite/and.hs
new file mode 100644 (file)
index 0000000..8e4ab2e
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.and (U.replicate 100 True))
+
diff --git a/old-testsuite/microsuite/append.hs b/old-testsuite/microsuite/append.hs
new file mode 100644 (file)
index 0000000..5995ad5
--- /dev/null
@@ -0,0 +1,5 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.map (`shiftL` 2) $
+           (U.++) (U.replicate 10000000 (1::Int))
+                  (U.replicate 10000000 (7::Int))
diff --git a/old-testsuite/microsuite/cons.hs b/old-testsuite/microsuite/cons.hs
new file mode 100644 (file)
index 0000000..7788918
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.sum . U.cons 0xdeadbeef . U.replicate (100000000::Int) $ (8::Int)
+
diff --git a/old-testsuite/microsuite/drop.hs b/old-testsuite/microsuite/drop.hs
new file mode 100644 (file)
index 0000000..6ef98b8
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.length . U.drop 100000 . U.replicate 1000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/elem.hs b/old-testsuite/microsuite/elem.hs
new file mode 100644 (file)
index 0000000..cdc336d
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.elem 100 . U.map (`shiftL` 1) . U.enumFromTo 1 $ (10000 :: Int)
+
diff --git a/old-testsuite/microsuite/empty.hs b/old-testsuite/microsuite/empty.hs
new file mode 100644 (file)
index 0000000..f706c7a
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.sum $ U.cons (0xdeadbeef::Int) U.empty
+
diff --git a/old-testsuite/microsuite/eq.hs b/old-testsuite/microsuite/eq.hs
new file mode 100644 (file)
index 0000000..d521a2f
--- /dev/null
@@ -0,0 +1,6 @@
+
+import qualified Data.Vector.Unboxed as U
+main = print ((==) (U.replicate 100000000 True)
+                   (U.replicate 100000000 True))
+
+
diff --git a/old-testsuite/microsuite/filter.hs b/old-testsuite/microsuite/filter.hs
new file mode 100644 (file)
index 0000000..dc5ef91
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.map (`shiftL` 1) . U.filter (<20). U.map (*2) . U.map (+1) . U.replicate (100000000::Int) $ (8::Int)
+
diff --git a/old-testsuite/microsuite/find.hs b/old-testsuite/microsuite/find.hs
new file mode 100644 (file)
index 0000000..bdb8fbf
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.find (==100) . U.map (`shiftL` 1) . U.enumFromTo 1 $ (10000 :: Int)
+
diff --git a/old-testsuite/microsuite/findIndex.hs b/old-testsuite/microsuite/findIndex.hs
new file mode 100644 (file)
index 0000000..576ccea
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.findIndex (==100) . U.map (`shiftL` 1) . U.enumFromTo 1 $ (10000 :: Int)
+
diff --git a/old-testsuite/microsuite/foldl1.hs b/old-testsuite/microsuite/foldl1.hs
new file mode 100644 (file)
index 0000000..4b8066c
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.foldl1 (+) . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/from-to.hs b/old-testsuite/microsuite/from-to.hs
new file mode 100644 (file)
index 0000000..703b899
--- /dev/null
@@ -0,0 +1,2 @@
+import qualified Data.Vector as U
+main = print . head . U.toList . U.fromList $ replicate 1 (7::Int)
diff --git a/old-testsuite/microsuite/head.hs b/old-testsuite/microsuite/head.hs
new file mode 100644 (file)
index 0000000..833c488
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.head . U.map (`shiftL` 1) . U.replicate 1000000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/index.hs b/old-testsuite/microsuite/index.hs
new file mode 100644 (file)
index 0000000..1c939d6
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . (\arr -> arr U.! 42) . U.map (subtract 6) . U.replicate 10000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/init.hs b/old-testsuite/microsuite/init.hs
new file mode 100644 (file)
index 0000000..daee197
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.length . U.init . U.replicate 1000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/last.hs b/old-testsuite/microsuite/last.hs
new file mode 100644 (file)
index 0000000..04e2a25
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.last . U.map (`shiftL` 1) . U.replicate 1000000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/length-bool.hs b/old-testsuite/microsuite/length-bool.hs
new file mode 100644 (file)
index 0000000..847d84c
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.length (U.replicate 1 True))
+
diff --git a/old-testsuite/microsuite/length-char.hs b/old-testsuite/microsuite/length-char.hs
new file mode 100644 (file)
index 0000000..12af798
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.length (U.replicate 1 'x'))
+
diff --git a/old-testsuite/microsuite/length-double.hs b/old-testsuite/microsuite/length-double.hs
new file mode 100644 (file)
index 0000000..ed5d318
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.length (U.replicate 1 (pi :: Double)))
+
diff --git a/old-testsuite/microsuite/length-float.hs b/old-testsuite/microsuite/length-float.hs
new file mode 100644 (file)
index 0000000..ce706fd
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.length (U.replicate 1 (pi :: Float)))
+
diff --git a/old-testsuite/microsuite/length-int16.hs b/old-testsuite/microsuite/length-int16.hs
new file mode 100644 (file)
index 0000000..6066cbd
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Int
+main = print (U.length (U.replicate 1 (7 :: Int16)))
+
diff --git a/old-testsuite/microsuite/length-int32.hs b/old-testsuite/microsuite/length-int32.hs
new file mode 100644 (file)
index 0000000..75c6ee4
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Int
+main = print (U.length (U.replicate 1 (7 :: Int32)))
+
diff --git a/old-testsuite/microsuite/length-int64.hs b/old-testsuite/microsuite/length-int64.hs
new file mode 100644 (file)
index 0000000..40c6a3f
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Int
+main = print (U.length (U.replicate 1 (7 :: Int64)))
+
diff --git a/old-testsuite/microsuite/length-int8.hs b/old-testsuite/microsuite/length-int8.hs
new file mode 100644 (file)
index 0000000..0d48abb
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Int
+main = print (U.length (U.replicate 1 (7 :: Int8)))
+
diff --git a/old-testsuite/microsuite/length-unit.hs b/old-testsuite/microsuite/length-unit.hs
new file mode 100644 (file)
index 0000000..c36a444
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.length (U.replicate 1 ()))
+
diff --git a/old-testsuite/microsuite/length-word.hs b/old-testsuite/microsuite/length-word.hs
new file mode 100644 (file)
index 0000000..ebba62b
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Word
+main = print (U.length (U.replicate 1 (7 :: Word)))
+
diff --git a/old-testsuite/microsuite/length-word16.hs b/old-testsuite/microsuite/length-word16.hs
new file mode 100644 (file)
index 0000000..66431d2
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Word
+main = print (U.length (U.replicate 1 (7 :: Word16)))
+
diff --git a/old-testsuite/microsuite/length-word32.hs b/old-testsuite/microsuite/length-word32.hs
new file mode 100644 (file)
index 0000000..5493ae1
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Word
+main = print (U.length (U.replicate 1 (7 :: Word32)))
+
diff --git a/old-testsuite/microsuite/length-word64.hs b/old-testsuite/microsuite/length-word64.hs
new file mode 100644 (file)
index 0000000..70c92b4
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Word
+main = print (U.length (U.replicate 1 (7 :: Word64)))
+
diff --git a/old-testsuite/microsuite/length-word8.hs b/old-testsuite/microsuite/length-word8.hs
new file mode 100644 (file)
index 0000000..3ddf9f1
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Word
+main = print (U.length (U.replicate 1 (7 :: Word8)))
+
diff --git a/old-testsuite/microsuite/length.hs b/old-testsuite/microsuite/length.hs
new file mode 100644 (file)
index 0000000..f23a9ff
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.length . U.enumFromTo 1 $ (100000000 :: Int)
+
diff --git a/old-testsuite/microsuite/lookup.hs b/old-testsuite/microsuite/lookup.hs
new file mode 100644 (file)
index 0000000..6cd8291
--- /dev/null
@@ -0,0 +1,5 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.lookup 10000
+             . U.zip (U.enumFromTo 1 (10000000 :: Int)) $
+                     (U.replicate (10000000 :: Int) (42::Int))
diff --git a/old-testsuite/microsuite/map.hs b/old-testsuite/microsuite/map.hs
new file mode 100644 (file)
index 0000000..61eebd1
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.map (`shiftL` 1) . U.map (*2) . U.map (+1) . U.replicate (100000000::Int) $ (8::Int)
+
diff --git a/old-testsuite/microsuite/maximum.hs b/old-testsuite/microsuite/maximum.hs
new file mode 100644 (file)
index 0000000..15f4248
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.maximum . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/maximumBy.hs b/old-testsuite/microsuite/maximumBy.hs
new file mode 100644 (file)
index 0000000..9f11230
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.maximumBy (\x y -> GT) . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/minimum.hs b/old-testsuite/microsuite/minimum.hs
new file mode 100644 (file)
index 0000000..a6647bd
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.minimum . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/minimumBy.hs b/old-testsuite/microsuite/minimumBy.hs
new file mode 100644 (file)
index 0000000..7c281c0
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.minimumBy (\x y -> GT) . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/null-ndp.hs b/old-testsuite/microsuite/null-ndp.hs
new file mode 100644 (file)
index 0000000..50df254
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U -- Parallel.Unlifted
+main = print . U.sum . U.map fstS . indexedU . U.enumFromTo 1 $ (100000000 :: Int)
+
diff --git a/old-testsuite/microsuite/null.hs b/old-testsuite/microsuite/null.hs
new file mode 100644 (file)
index 0000000..ea96cd8
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.null . U.filter (>10) . U.map (subtract 6) . U.enumFromTo 1 $ (100000000 :: Int)
+
diff --git a/old-testsuite/microsuite/or.hs b/old-testsuite/microsuite/or.hs
new file mode 100644 (file)
index 0000000..c7fa3fe
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print (U.or (U.replicate 100 True))
+
diff --git a/old-testsuite/microsuite/product.hs b/old-testsuite/microsuite/product.hs
new file mode 100644 (file)
index 0000000..ec4ff84
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.product . U.map (*2) . U.map (`shiftL` 2) $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/repeat.hs b/old-testsuite/microsuite/repeat.hs
new file mode 100644 (file)
index 0000000..d903c56
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.repeat 10 $ U.replicate (10000000 :: Int) (5::Int) 
+
diff --git a/old-testsuite/microsuite/replicate.hs b/old-testsuite/microsuite/replicate.hs
new file mode 100644 (file)
index 0000000..35ba1e2
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.sum . U.map (subtract 7) . U.replicate 10000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/singleton.hs b/old-testsuite/microsuite/singleton.hs
new file mode 100644 (file)
index 0000000..a27dc8f
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.sum $ U.cons (10::Int) (U.singleton 2)
+
diff --git a/old-testsuite/microsuite/snoc.hs b/old-testsuite/microsuite/snoc.hs
new file mode 100644 (file)
index 0000000..a0e57ca
--- /dev/null
@@ -0,0 +1,3 @@
+import qualified Data.Vector as U
+main = print . U.sum . (\e -> U.snoc e 0xdeadbeef) . U.replicate (100000000::Int) $ (8::Int)
+
diff --git a/old-testsuite/microsuite/sum-complex.hs b/old-testsuite/microsuite/sum-complex.hs
new file mode 100644 (file)
index 0000000..5836543
--- /dev/null
@@ -0,0 +1,5 @@
+import qualified Data.Vector as U
+import Data.Complex
+
+main = print . U.sum $ U.replicate (1000000000 :: Int) (1 :+ 1 ::Complex Double)
+
diff --git a/old-testsuite/microsuite/sum-ratio.hs b/old-testsuite/microsuite/sum-ratio.hs
new file mode 100644 (file)
index 0000000..38195c6
--- /dev/null
@@ -0,0 +1,5 @@
+import qualified Data.Vector as U
+import Data.Ratio
+
+main = print . U.sum $ U.replicate (100000000 :: Int) (1 % 2 :: Rational)
+
diff --git a/old-testsuite/microsuite/sum.hs b/old-testsuite/microsuite/sum.hs
new file mode 100644 (file)
index 0000000..3cb2803
--- /dev/null
@@ -0,0 +1,8 @@
+import qualified Data.Vector as U
+import Data.Bits
+
+main = print . U.sum
+             . U.map (*2)
+             . U.map (`shiftL` 2)
+             $ U.replicate (100000000 :: Int) (5::Int)
+
diff --git a/old-testsuite/microsuite/tail.hs b/old-testsuite/microsuite/tail.hs
new file mode 100644 (file)
index 0000000..dfdd44f
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.length . U.tail . U.replicate 1000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/take.hs b/old-testsuite/microsuite/take.hs
new file mode 100644 (file)
index 0000000..bc61f9d
--- /dev/null
@@ -0,0 +1,4 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.length . U.take 100000 . U.replicate 1000000 $ (7 :: Int)
+
diff --git a/old-testsuite/microsuite/takeWhile.hs b/old-testsuite/microsuite/takeWhile.hs
new file mode 100644 (file)
index 0000000..21ecae3
--- /dev/null
@@ -0,0 +1,7 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.takeWhile (< (7::Int)).  U.enumFromTo 1 $ 10000000
+
+    -- U.replicate 1000000 $ (7 :: Int)
+
+    -- gets removed entirely!
diff --git a/old-testsuite/microsuite/unfold.hs b/old-testsuite/microsuite/unfold.hs
new file mode 100644 (file)
index 0000000..688bbd3
--- /dev/null
@@ -0,0 +1,5 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum $ unfoldU 10000 k (0::Int)
+    where
+        k b = JustS (b :*: b+1) -- enumFromTo
diff --git a/old-testsuite/microsuite/zip.hs b/old-testsuite/microsuite/zip.hs
new file mode 100644 (file)
index 0000000..fbad470
--- /dev/null
@@ -0,0 +1,6 @@
+import qualified Data.Vector.Unboxed as U
+import Data.Bits
+main = print . U.sum . U.map fst $ U.zip
+                        (U.enumFromTo 1 (100000000 :: Int))
+                        (U.enumFromTo 2 (100000001 :: Int))
+
diff --git a/old-testsuite/microsuite/zipwith.hs b/old-testsuite/microsuite/zipwith.hs
new file mode 100644 (file)
index 0000000..dff9b18
--- /dev/null
@@ -0,0 +1,6 @@
+import qualified Data.Vector as U
+import Data.Bits
+main = print . U.sum . U.map (`shiftL` 1) $ U.zipWith (*)
+                        (U.enumFromTo 1 (100000000 :: Int))
+                        (U.replicate (100000000 :: Int) 42)
+
diff --git a/old-testsuite/microsuite/zipwith3.hs b/old-testsuite/microsuite/zipwith3.hs
new file mode 100644 (file)
index 0000000..e25b511
--- /dev/null
@@ -0,0 +1,7 @@
+import qualified Data.Vector.Unboxed as U
+import Data.Bits
+main = print . U.sum $ U.zipWith3 (\x y z -> x * y * z)
+                        (U.enumFromTo 1 (100000000 :: Int))
+                        (U.enumFromTo 2 (100000001 :: Int))
+                        (U.enumFromTo 7 (100000008 :: Int))
+