Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
test-primops
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
test-primops
Commits
59ed6ef3
Commit
59ed6ef3
authored
2 years ago
by
Ben Gamari
Browse files
Options
Downloads
Patches
Plain Diff
Dynamically probe word size
parent
e7d5ce0b
No related branches found
No related tags found
1 merge request
!10
Enable testing of Word64# on 32-bit platforms
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
run.sh
+9
-2
9 additions, 2 deletions
run.sh
src/RunGhc.hs
+7
-0
7 additions, 0 deletions
src/RunGhc.hs
src/Width.hs
+2
-2
2 additions, 2 deletions
src/Width.hs
test-primops.cabal
+10
-0
10 additions, 0 deletions
test-primops.cabal
with
28 additions
and
4 deletions
run.sh
+
9
−
2
View file @
59ed6ef3
...
...
@@ -7,9 +7,16 @@ TEST_GHC="${TEST_GHC:-ghc}"
CABAL
=
"
${
CABAL
:-
cabal
}
"
EMULATOR
=
"
${
EMULATOR
:-}
"
if
"
$TEST_GHC
"
--info
|
grep
-q
'("target word size","8")'
;
then
echo
"Found 64-bit target"
else
echo
"Found 32-bit target"
CABAL_ARGS
=
"-ftarget-32-bit"
fi
build_runit
()
{
ALLOW_NEWER
=
"--allow-newer=base"
"
$CABAL
"
build
$ALLOW_NEWER
-w
"
$TEST_GHC
"
run-it
"
$CABAL
"
build
$ALLOW_NEWER
-w
"
$TEST_GHC
"
$CABAL_ARGS
run-it
RUNIT
=
"
$(
"
$CABAL
"
list-bin
$ALLOW_NEWER
-w
"
$TEST_GHC
"
run-it
)
"
echo
"runit is
$RUNIT
"
}
...
...
@@ -23,7 +30,7 @@ run() {
if
[[
-n
"
$EMULATOR
"
]]
;
then
args+
=(
"--emulator=
$EMULATOR
"
)
fi
"
$CABAL
"
run
-w
"
$BOOT_GHC
"
test-primops
--
"
${
args
[@]
}
"
"
$@
"
"
$CABAL
"
run
-w
"
$BOOT_GHC
"
$CABAL_ARGS
test-primops
--
"
${
args
[@]
}
"
"
$@
"
}
repl
()
{
...
...
This diff is collapsed.
Click to expand it.
src/RunGhc.hs
+
7
−
0
View file @
59ed6ef3
{-# LANGUAGE CPP #-}
-- | Utilities for running GHC and evaluating Cmm via @run-it@.
module
RunGhc
(
EvalMethod
(
..
)
...
...
@@ -95,8 +97,13 @@ mkStaticWrapper comp width = do
hsType
::
Width
->
String
hsType
W8
=
"Word8#"
hsType
W16
=
"Word16#"
#
if
defined
(
WORD_SIZE_32BIT
)
hsType
W32
=
"Word32#"
hsType
W64
=
"Word64#"
#
else
hsType
W32
=
"Word32#"
hsType
W64
=
"Word#"
#
endif
toHsWord
::
Width
->
String
->
String
toHsWord
w
x
=
"W# "
<>
parens
(
extendFn
<>
" "
<>
parens
x
)
...
...
This diff is collapsed.
Click to expand it.
src/Width.hs
+
2
−
2
View file @
59ed6ef3
...
...
@@ -30,9 +30,9 @@ import Data.Proxy
import
Test.QuickCheck
hiding
((
.&.
))
import
Prelude
hiding
(
truncate
)
#
if
WORD_SIZE_
IN_BITS
==
32
#
if
defined
(
WORD_SIZE_
32BIT
)
type
WordSize
=
W32
#
elif
WORD_SIZE_
IN_BITS
==
64
#
elif
defined
(
WORD_SIZE_
64BIT
)
type
WordSize
=
W64
#
else
#
error
unknown
word
size
...
...
This diff is collapsed.
Click to expand it.
test-primops.cabal
+
10
−
0
View file @
59ed6ef3
...
...
@@ -8,9 +8,19 @@ copyright: (c) 2021 Ben Gamari
synopsis:
A QuickCheck testsuite for GHC's Cmm pipeline.
flag target-32bit
description: Set to True when the compiler-under-test targets a
platform with 32-bit word-size.
default: False
manual: True
executable test-primops
main-is: Main.hs
hs-source-dirs: src
if flag(target-32bit)
cpp-options: -DWORD_SIZE_32BIT
else
cpp-options: -DWORD_SIZE_64BIT
other-modules: Width,
Number,
Expr,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment