diff options
author | Ian Lynagh <igloo@earth.li> | 2012-01-26 13:45:03 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-01-26 14:55:31 +0000 |
commit | 69017cae495e4ae84fe3796a151e2407fbd65cbb (patch) | |
tree | 361a959a59220ecfb79986dbe7f501f0c7d1517d /testsuite/tests/lib | |
parent | 9e5aa3300072c2fbf83ee1423c6c4364aca1a162 (diff) | |
download | haskell-69017cae495e4ae84fe3796a151e2407fbd65cbb.tar.gz |
Add a test for the integerToInt/smallInteger rule
Diffstat (limited to 'testsuite/tests/lib')
-rw-r--r-- | testsuite/tests/lib/integer/Makefile | 7 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/all.T | 4 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/integerToInt_smallInteger.hs | 11 |
3 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/lib/integer/Makefile b/testsuite/tests/lib/integer/Makefile index 5199157670..71a34a3542 100644 --- a/testsuite/tests/lib/integer/Makefile +++ b/testsuite/tests/lib/integer/Makefile @@ -36,3 +36,10 @@ integerConstantFolding: $(call CHECK,\<400280.0\>,encodeIntegerFloat) ./integerConstantFolding +.PHONY: integerToInt_smallInteger +integerToInt_smallInteger: + '$(TEST_HC)' -Wall -v0 -O -c integerToInt_smallInteger.hs -fforce-recomp -ddump-simpl > integerToInt_smallInteger.simpl +# Rules should eliminate both functions + -grep integerToInt integerToInt_smallInteger.simpl + -grep smallInteger integerToInt_smallInteger.simpl + diff --git a/testsuite/tests/lib/integer/all.T b/testsuite/tests/lib/integer/all.T index ecff8fb6ce..54782c067c 100644 --- a/testsuite/tests/lib/integer/all.T +++ b/testsuite/tests/lib/integer/all.T @@ -4,4 +4,8 @@ test('integerConstantFolding', extra_clean(['integerConstantFolding.simpl']), run_command, ['$MAKE -s --no-print-directory integerConstantFolding']) +test('integerToInt_smallInteger', + extra_clean(['integerToInt_smallInteger.simpl']), + run_command, + ['$MAKE -s --no-print-directory integerToInt_smallInteger']) diff --git a/testsuite/tests/lib/integer/integerToInt_smallInteger.hs b/testsuite/tests/lib/integer/integerToInt_smallInteger.hs new file mode 100644 index 0000000000..e084e05dc4 --- /dev/null +++ b/testsuite/tests/lib/integer/integerToInt_smallInteger.hs @@ -0,0 +1,11 @@ + +{-# LANGUAGE MagicHash #-} + +module Q where + +import GHC.Exts +import GHC.Integer + +v :: Int +v = I# (integerToInt (smallInteger 3#)) + |