Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/3c25de8d2abb744411e5af852356a8734dc2e37f >--------------------------------------------------------------- commit 3c25de8d2abb744411e5af852356a8734dc2e37f Author: Paolo Capriotti <[email protected]> Date: Wed Jun 27 18:45:53 2012 +0100 Add test case for #5900 >--------------------------------------------------------------- tests/codeGen/should_run/T5900.hs | 25 +++++++++++++++++++++++++ tests/codeGen/should_run/T5900.stderr | 1 + tests/codeGen/should_run/T5900.stdout | 1 + tests/codeGen/should_run/all.T | 2 +- 4 files changed, 28 insertions(+), 1 deletions(-) diff --git a/tests/codeGen/should_run/T5900.hs b/tests/codeGen/should_run/T5900.hs new file mode 100644 index 0000000..231edeb --- /dev/null +++ b/tests/codeGen/should_run/T5900.hs @@ -0,0 +1,25 @@ +import Data.Bits +import Data.Word +import Debug.Trace + +fl :: Word64 -> Word64 -> Word64 +fl fin sk = + let (x1, x2) = w64tow32 fin in + let (k1, k2) = w64tow32 sk in + let y2 = x2 `xor` ((x1 .&. k1) `rotateL` 1) in + let y1 = x1 `xor` (y2 .|. k2) in + trace (show fin ++ " " ++ show sk ++ " -> " ++ show (w32tow64 (y1, y2))) $ w32tow64 (y1, y2) + +w64tow32 :: Word64 -> (Word32, Word32) +w64tow32 w = (fromIntegral (w `shiftR` 32), fromIntegral (w .&. 0xffffffff)) + +w32tow64 :: (Word32, Word32) -> Word64 +w32tow64 (x1, x2) = ((fromIntegral x1) `shiftL` 32) .|. (fromIntegral x2) + +a, b :: Word64 +a = 1238988323332265734 +b = 11185553392205053542 + +main :: IO () +main = + putStrLn $ "fl " ++ show a ++ " " ++ show b ++ " -> " ++ show (fl a b) diff --git a/tests/codeGen/should_run/T5900.stderr b/tests/codeGen/should_run/T5900.stderr new file mode 100644 index 0000000..edea8b8 --- /dev/null +++ b/tests/codeGen/should_run/T5900.stderr @@ -0,0 +1 @@ +1238988323332265734 11185553392205053542 -> 18360184157246690566 diff --git a/tests/codeGen/should_run/T5900.stdout b/tests/codeGen/should_run/T5900.stdout new file mode 100644 index 0000000..f422ff9 --- /dev/null +++ b/tests/codeGen/should_run/T5900.stdout @@ -0,0 +1 @@ +fl 1238988323332265734 11185553392205053542 -> 18360184157246690566 diff --git a/tests/codeGen/should_run/all.T b/tests/codeGen/should_run/all.T index 272eb4a..c03ea50 100644 --- a/tests/codeGen/should_run/all.T +++ b/tests/codeGen/should_run/all.T @@ -92,4 +92,4 @@ test('5785', normal, compile_and_run, ['']) test('setByteArray', normal, compile_and_run, ['']) test('6146', normal, compile_and_run, ['']) - +test('T5900', normal, compile_and_run, ['']) _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
