diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-05-27 20:14:39 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-29 10:18:01 -0400 |
commit | 453877600b78fbb8d53ebc1754e79879456b8419 (patch) | |
tree | a3e2c8410ac3e09ff9f707b8bacf03073933486c /testsuite/tests/numeric | |
parent | 492b2dc53f3d0d61d78a31a749aa8b364bebb891 (diff) | |
download | haskell-453877600b78fbb8d53ebc1754e79879456b8419.tar.gz |
Bignum: match on DataCon workers in rules (#19892)
We need to match on DataCon workers for the rules to be triggered.
T13701 ghc/alloc decreases by ~2.5% on some archs
Metric Decrease:
T13701
Diffstat (limited to 'testsuite/tests/numeric')
4 files changed, 25 insertions, 4 deletions
diff --git a/testsuite/tests/numeric/should_compile/T14465.stdout b/testsuite/tests/numeric/should_compile/T14465.stdout index 970ceb4fd2..00d3101eb4 100644 --- a/testsuite/tests/numeric/should_compile/T14465.stdout +++ b/testsuite/tests/numeric/should_compile/T14465.stdout @@ -1,14 +1,14 @@ ==================== Tidy Core ==================== Result size of Tidy Core - = {terms: 35, types: 14, coercions: 0, joins: 0/0} + = {terms: 34, types: 14, coercions: 0, joins: 0/0} --- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} ten :: Natural [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, - WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] -ten = GHC.Num.Natural.NS 10## + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}] +ten = 10 -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} M.$trModule4 :: GHC.Prim.Addr# diff --git a/testsuite/tests/numeric/should_compile/T19892.hs b/testsuite/tests/numeric/should_compile/T19892.hs new file mode 100644 index 0000000000..cd8d9018b8 --- /dev/null +++ b/testsuite/tests/numeric/should_compile/T19892.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE MagicHash #-} + +module T19892 where + +import GHC.Exts +import GHC.Num.Integer +import GHC.Num.Natural + +foo :: Word# -> Word# +foo x = integerToWord# (IS (word2Int# x)) + +bar :: Int# -> Int# +bar x = integerToInt# (IS x) + +baz :: Word# -> Word# +baz x = naturalToWord# (NS x) diff --git a/testsuite/tests/numeric/should_compile/T19892.stderr b/testsuite/tests/numeric/should_compile/T19892.stderr new file mode 100644 index 0000000000..89411a6df9 --- /dev/null +++ b/testsuite/tests/numeric/should_compile/T19892.stderr @@ -0,0 +1,4 @@ +Rule fired: Int# -> Integer -> Word# (BUILTIN) +Rule fired: int2Word# (BUILTIN) +Rule fired: Int# -> Integer -> Int# (BUILTIN) +Rule fired: Word# -> Natural -> Word# (BUILTIN) diff --git a/testsuite/tests/numeric/should_compile/all.T b/testsuite/tests/numeric/should_compile/all.T index 8f0b268690..766dda4814 100644 --- a/testsuite/tests/numeric/should_compile/all.T +++ b/testsuite/tests/numeric/should_compile/all.T @@ -9,3 +9,4 @@ test('T7881', normal, compile, ['']) test('T8542', omit_ways(['hpc']), compile, ['']) test('T10929', normal, compile, ['']) test('T16402', [ grep_errmsg(r'and'), when(wordsize(32), expect_broken(19024)) ], compile, ['']) +test('T19892', normal, compile, ['-O -ddump-rule-firings']) |