Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
52037f72
Commit
52037f72
authored
Feb 24, 2012
by
Ian Lynagh
Browse files
Add a test for 2-word-multiply
parent
1128d8a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/numeric/should_run/all.T
View file @
52037f72
...
...
@@ -55,4 +55,5 @@ test('4381', normal, compile_and_run, [''])
test
('
4383
',
normal
,
compile_and_run
,
[''])
test
('
add2
',
normal
,
compile_and_run
,
[''])
test
('
mul2
',
normal
,
compile_and_run
,
[''])
testsuite/tests/numeric/should_run/mul2.hs
0 → 100644
View file @
52037f72
{-# LANGUAGE MagicHash, UnboxedTuples #-}
import
GHC.Prim
import
GHC.Word
import
Data.Bits
main
::
IO
()
main
=
do
f
5
6
f
0xFE36FB18
49
f
0xFE36FB18
0xFB29FC6A
f
::
Word
->
Word
->
IO
()
f
wx
@
(
W
#
x
)
wy
@
(
W
#
y
)
=
do
putStrLn
"-----"
putStrLn
(
"Doing "
++
show
wx
++
" * "
++
show
wy
)
case
x
`
timesWord2
#
`
y
of
(
#
h
,
l
#
)
->
do
let
wh
=
W
#
h
wl
=
W
#
l
r
=
shiftL
(
fromIntegral
wh
)
(
bitSize
wh
)
+
fromIntegral
wl
putStrLn
(
"High: "
++
show
wh
)
putStrLn
(
"Low: "
++
show
wl
)
putStrLn
(
"Result: "
++
show
(
r
::
Integer
))
testsuite/tests/numeric/should_run/mul2.stdout
0 → 100644
View file @
52037f72
-----
Doing 5 * 6
High: 0
Low: 30
Result: 30
-----
Doing 4265016088 * 49
High: 0
Low: 208985788312
Result: 208985788312
-----
Doing 4265016088 * 4213832810
High: 0
Low: 17972064726792247280
Result: 17972064726792247280
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment