Makefile 2.63 KB
Newer Older
1
2
3
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
4
5
6
7
8
9
10
11
12
13

CHECK = grep -q -- '$1' integerConstantFolding.simpl || \
        echo "$2 didn't constant fold"

.PHONY: integerConstantFolding
integerConstantFolding:
	'$(TEST_HC)' -Wall -v0 -O --make integerConstantFolding -fforce-recomp -ddump-simpl > integerConstantFolding.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; }
	$(call CHECK,\<200007\>,plusInteger)
14
	$(call CHECK,\<683234160\>,timesInteger)
15
16
17
18
19
20
21
22
23
24
	$(call CHECK,-991\>,minusIntegerN)
	$(call CHECK,\<989\>,minusIntegerP)
	$(call CHECK,-200011\>,negateInteger)
	$(call CHECK,\<200019\>,absInteger)
	$(call CHECK,\<50024\>,gcdInteger)
	$(call CHECK,\<1001100300\>,lcmInteger)
	$(call CHECK,\<532\>,andInteger)
	$(call CHECK,\<239575\>,orInteger)
	$(call CHECK,\<239041\>,xorInteger)
	$(call CHECK,-200059\>,complementInteger)
25
26
27
28
29
30
	$(call CHECK,\<813\>,quotRemInteger)
	$(call CHECK,\<60\>,quotRemInteger)
	$(call CHECK,\<219\>,divModInteger)
	$(call CHECK,\<196\>,divModInteger)
	$(call CHECK,\<1600976\>,shiftLInteger)
	$(call CHECK,\<6253\>,shiftRInteger)
31
32
	$(call CHECK,\<641\>,quotInteger)
	$(call CHECK,\<68\>,remInteger)
33
34
	$(call CHECK,\<200131.0\>,doubleFromInteger)
	$(call CHECK,\<200135.0\>,floatFromInteger)
35
36
	$(call CHECK,\<400276.0\>,encodeIntegerDouble)
	$(call CHECK,\<400280.0\>,encodeIntegerFloat)
37
38
	./integerConstantFolding

39
40
41
42
43
44
45
46
.PHONY: fromToInteger
fromToInteger:
	'$(TEST_HC)' -Wall -v0 -O -c fromToInteger.hs -fforce-recomp -ddump-simpl > fromToInteger.simpl
# Rules should eliminate all functions
	-grep integerToInt fromToInteger.simpl
	-grep smallInteger fromToInteger.simpl
	-grep integerToWord fromToInteger.simpl
	-grep wordToInteger fromToInteger.simpl
47

Ian Lynagh's avatar
Ian Lynagh committed
48
49
50
51
52
53
54
55
56
57
58
.PHONY: IntegerConversionRules
IntegerConversionRules:
	'$(TEST_HC)' -Wall -v0 -O -c $@.hs -fforce-recomp -ddump-simpl > $@.simpl
	-grep -q smallInteger      $@.simpl && echo "smallInteger present"
	-grep -q doubleFromInteger $@.simpl && echo "doubleFromInteger present"
	-grep -q int2Double        $@.simpl || echo "int2Double absent"
	-grep -q floatFromInteger  $@.simpl && echo "floatFromInteger present"
	-grep -q int2Float         $@.simpl || echo "int2Float absent"
	-grep -q integerToWord     $@.simpl && echo "integerToWord present"
	-grep -q int2Word          $@.simpl || echo "int2Word absent"

59
60
61
62
63
64
.PHONY: T7041
T7041:
	'$(TEST_HC)' -Wall -v0 -O -c $@.hs -fforce-recomp -ddump-simpl > $@.simpl
	-grep -q gcdInteger        $@.simpl && echo "gcdInteger present"
	-grep -q "gcdInt\>"        $@.simpl || echo "gcdInt absent"