Use 64bit args in mul2
[ghc.git] / testsuite / tests / numeric / should_run / mul2.hs
1
2 {-# LANGUAGE MagicHash, UnboxedTuples #-}
3
4 import GHC.Prim
5 import GHC.Word
6 import Data.Bits
7
8 main :: IO ()
9 main = do f 5 6
10 f 0xFD94E3B7FE36FB18 49
11 f 0xFD94E3B7FE36FB18 0xFC1D8A3BFB29FC6A
12
13 f :: Word -> Word -> IO ()
14 f wx@(W# x) wy@(W# y)
15 = do putStrLn "-----"
16 putStrLn ("Doing " ++ show wx ++ " * " ++ show wy)
17 case x `timesWord2#` y of
18 (# h, l #) ->
19 do let wh = W# h
20 wl = W# l
21 r = shiftL (fromIntegral wh) (bitSize wh)
22 + fromIntegral wl
23 putStrLn ("High: " ++ show wh)
24 putStrLn ("Low: " ++ show wl)
25 putStrLn ("Result: " ++ show (r :: Integer))
26