summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/integer/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/integer/Makefile')
-rw-r--r--testsuite/tests/lib/integer/Makefile50
1 files changed, 47 insertions, 3 deletions
diff --git a/testsuite/tests/lib/integer/Makefile b/testsuite/tests/lib/integer/Makefile
index aa2704ab6d..4292a1b970 100644
--- a/testsuite/tests/lib/integer/Makefile
+++ b/testsuite/tests/lib/integer/Makefile
@@ -2,14 +2,18 @@ TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-CHECK = grep -q -- '$1' integerConstantFolding.simpl || \
+CHECK = grep -q -- '$1' folding.simpl || \
echo "$2 didn't constant fold"
+CHECK2 = grep -q -- '$1' folding.simpl || \
+ grep -q -- '$2' folding.simpl || \
+ echo "$3 didn't constant fold"
+
.PHONY: integerConstantFolding
integerConstantFolding:
- '$(TEST_HC)' -Wall -v0 -O --make integerConstantFolding -fforce-recomp -ddump-simpl > integerConstantFolding.simpl
+ '$(TEST_HC)' -Wall -v0 -O --make integerConstantFolding -fforce-recomp -ddump-simpl > folding.simpl
# All the 100nnn values should be constant-folded away
- ! grep -q '\<100[0-9][0-9][0-9]\>' integerConstantFolding.simpl || { echo "Unfolded values found"; grep '\<100[0-9][0-9][0-9]\>' integerConstantFolding.simpl; }
+ ! grep -q '\<100[0-9][0-9][0-9]\>' folding.simpl || { echo "Unfolded values found"; grep '\<100[0-9][0-9][0-9]\>' folding.simpl; }
$(call CHECK,\<200007\>,plusInteger)
$(call CHECK,\<683234160\>,timesInteger)
$(call CHECK,-991\>,minusIntegerN)
@@ -58,3 +62,43 @@ IntegerConversionRules:
-grep -q integerToWord $@.simpl && echo "integerToWord present"
-grep -q int2Word $@.simpl || echo "int2Word absent"
+.PHONY: naturalConstantFolding
+naturalConstantFolding:
+ '$(TEST_HC)' -Wall -v0 -O --make naturalConstantFolding -fforce-recomp -ddump-simpl > folding.simpl
+# All the 100nnn values should be constant-folded away
+ ! grep -q '\<100[0-9][0-9][0-9]\>' folding.simpl || { echo "Unfolded values found"; grep '\<100[0-9][0-9][0-9]\>' folding.simpl; }
+ # Bit arithmetic
+ $(call CHECK,\<532\>,andNatural)
+ $(call CHECK,\<239055\>,xorNatural)
+ $(call CHECK,\<16\>,bitNatural)
+ $(call CHECK,\<239579\>,orNatural)
+ $(call CHECK,\<1601040\>,shiftLNatural)
+ $(call CHECK,\<6254\>,shiftRNatural)
+ $(call CHECK,\<6\>,popCountNatural)
+ # Arithmetic
+ $(call CHECK,\<200121\>,plusNatural)
+ $(call CHECK,\<683678240\>,timesNatural)
+ $(call CHECK,\<989\>,minusNatural)
+ $(call CHECK,\<0\>,negateNatural)
+ $(call CHECK,\<1\>,signumNaturalP)
+ $(call CHECK,\<0\>,signumNaturalZ)
+ # Quotients and remainders
+ $(call CHECK2,\<813\>,\<60\>,quotRemNatural)
+ $(call CHECK2,\<219\>,\<196\>,divModNatural)
+ $(call CHECK,\<641\>,quotNatural)
+ $(call CHECK,\<68\>,remNatural)
+ $(call CHECK,\<642\>,divNatural)
+ $(call CHECK,\<90\>,modNatural)
+ $(call CHECK,\<50024\>,gcdNatural)
+ $(call CHECK,\<1001100300\>,lcmNatural)
+ # Conversions
+ $(call CHECK,\<200109\>,naturalFromInteger)
+ $(call CHECK,\<200113\>,naturalToInteger)
+ $(call CHECK,\<200145\>,wordToNatural)
+ $(call CHECK,\<200149\>,naturalToWord)
+ $(call CHECK,\<200153\>,intToNatural)
+ $(call CHECK,\<200157\>,naturalToInt)
+ $(call CHECK,\<200189.0\>,doubleFromNatural)
+ $(call CHECK,\<200193.0\>,floatFromNatural)
+ # Ordering and Equality
+ ./naturalConstantFolding