Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
0d5427fe
Commit
0d5427fe
authored
Nov 16, 2006
by
Samuel Bronson
Browse files
Add tests for bitshift PrelRules
parent
335e5511
Changes
3
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/simplCore/should_run/all.T
View file @
0d5427fe
...
...
@@ -15,3 +15,4 @@ test('simplrun003', normal, compile_and_run, [''])
test
('
simplrun004
',
normal
,
compile_and_run
,
[''])
test
('
simplrun005
',
normal
,
compile_and_run
,
[''])
test
('
simplrun006
',
normal
,
compile_and_run
,
[''])
test
('
simplrun007
',
normal
,
compile_and_run
,
[''])
testsuite/tests/ghc-regress/simplCore/should_run/simplrun007.hs
0 → 100644
View file @
0d5427fe
{-# OPTIONS_GHC -fglasgow-exts #-}
-- Actually, this exercises prelude/PrelRules, but this is the closest
-- place I could find to put it...
import
GHC.Exts
import
Numeric
import
Data.Bits
main
=
do
phex
(
I
#
(
uncheckedIShiftL
#
(
negateInt
#
5
#
)
2
#
))
phex
(
I
#
(
uncheckedIShiftRA
#
(
negateInt
#
5
#
)
1
#
))
phex
(
I
#
(
uncheckedIShiftRL
#
(
negateInt
#
5
#
)
1
#
))
phex
(
W
#
(
uncheckedShiftL
#
(
int2Word
#
(
negateInt
#
5
#
))
2
#
))
phex
(
W
#
(
uncheckedShiftRL
#
(
int2Word
#
(
negateInt
#
5
#
))
1
#
))
phex
x
=
putStrLn
(
showSigned
(
\
x
->
(
"0x"
++
)
.
showHex
x
)
0
x
""
)
{- Too wordsize-dependant
phex x = putStrLn (hex x)
hex x = "0x" ++ [onedigit (fromIntegral ((x `shiftR` (i*4)) .&. 0xF))
| i <- [digits-1,digits-2..0]]
where
digits = bitSize x `div` 4
onedigit n = "0123456789abcdef" !! n
-}
testsuite/tests/ghc-regress/simplCore/should_run/simplrun007.stdout
0 → 100644
View file @
0d5427fe
-0x14
-0x3
0x7ffffffd
0xffffffec
0x7ffffffd
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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