blob: 95bc361a97bb8354dd7a3b129ccb12ea7ce3e6d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# RUN: %kleaver --builder=constant-folding -print-ast %s > %t
array a[64] : w32 -> w8 = symbolic
# RUN: grep -A 2 \"# Query 1\" %t > %t2
# RUN: grep \"(query .. false)\" %t2
(query [] (Not (Ult (w32 0) (w32 1))))
# Check -- 0 + X ==> X
# RUN: grep -A 2 \"# Query 2\" %t > %t2
# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2
(query [] false [(Add w8 0 (Read w8 0 a))])
# RUN: grep -A 2 \"# Query 3\" %t > %t2
# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2
(query [] false [(Add w8 (Read w8 0 a) 0)])
# Check -- C_0 + (C_1 + X) ==> (C_0 + C_1) + X
# RUN: grep -A 2 \"# Query 4\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2
(query [] false [(Add w8 10 (Add w8 20 (Read w8 0 a)))])
# Check -- C_0 + (X + C_1) ==> (C_0 + C_1) + X
# RUN: grep -A 2 \"# Query 5\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2
(query [] false [(Add w8 10 (Add w8 (Read w8 0 a) 20))])
# Check -- C_0 + (C_1 - X) ==> (C_0 + C_1) - X
# RUN: grep -A 2 \"# Query 6\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a)).)\" %t2
(query [] false [(Add w8 10 (Sub w8 20 (Read w8 0 a)))])
# Check -- C_0 + (X - C_1) ==> (C_0 - C_1) + X
# RUN: grep -A 2 \"# Query 7\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a)).)\" %t2
(query [] false [(Add w8 10 (Sub w8 (Read w8 0 a) 20))])
# Check -- (X + Y) + Z ==> X + (Y + Z)
# RUN: grep -A 3 \"# Query 8\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2
# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2
(query [] false [(Add w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))])
# Check -- (X - Y) + Z ==> X + (Z - Y)
# RUN: grep -A 3 \"# Query 9\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2
# RUN: grep \"(Sub w8 (Read w8 2 a) (Read w8 1 a)\" %t2
(query [] false [(Add w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))])
# Check -- X + (C + Y) ==> C + (X + Y)
# RUN: grep -A 3 \"# Query 10\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 10\" %t2
# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Add w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))])
# Check -- X + (Y + C) ==> C + (X + Y)
# RUN: grep -A 3 \"# Query 11\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 10\" %t2
# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Add w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))])
# Check -- X + (C - Y) ==> C + (X - Y)
# RUN: grep -A 3 \"# Query 12\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 10\" %t2
# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Add w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))])
# Check -- X + (Y - C) ==> -C + (X + Y)
# RUN: grep -A 3 \"# Query 13\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246\" %t2
# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Add w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))])
# Check -- C_0 - (C_1 + X) ==> (C_0 - C1) - X
# RUN: grep -A 2 \"# Query 14\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 20 (Add w8 10 (Read w8 0 a)))])
# Check -- C_0 - (X + C_1) ==> (C_0 + C1) + X
# RUN: grep -A 2 \"# Query 15\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 20 (Add w8 (Read w8 0 a) 10))])
# Check -- C_0 - (C_1 - X) ==> (C_0 - C1) + X
# RUN: grep -A 2 \"# Query 16\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 10 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 20 (Sub w8 10 (Read w8 0 a)))])
# Check -- C_0 - (X - C_1) ==> (C_0 + C1) - X
# RUN: grep -A 2 \"# Query 17\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 20 (Sub w8 (Read w8 0 a) 10))])
# Check -- (C_0 + X) - C_1 ==> (C_0 - C1) + X
# RUN: grep -A 2 \"# Query 18\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 (Add w8 10 (Read w8 0 a)) 20)])
# Check -- (X + C_0) - C_1 ==> (C_0 - C1) + X
# RUN: grep -A 2 \"# Query 19\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 (Add w8 (Read w8 0 a) 10) 20)])
# Check -- (C_0 - X) - C_1 ==> (C_0 - C1) - X
# RUN: grep -A 2 \"# Query 20\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 246 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 (Sub w8 10 (Read w8 0 a)) 20)])
# Check -- (X - C_0) - C_1 ==> -(C_0 + C1) + X
# RUN: grep -A 2 \"# Query 21\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 226 (Read w8 0 a))\" %t2
(query [] false [(Sub w8 (Sub w8 (Read w8 0 a) 10) 20)])
# Check -- (X + Y) - Z ==> X + (Y - Z)
# RUN: grep -A 3 \"# Query 22\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2
# RUN: grep \"(Sub w8 (Read w8 1 a) (Read w8 2 a)\" %t2
(query [] false [(Sub w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))])
# Check -- (X - Y) - Z ==> X - (Y + Z)
# RUN: grep -A 3 \"# Query 23\" %t > %t2
# RUN: grep \"(query .. false .(Sub w8 (Read w8 0 a)\" %t2
# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2
(query [] false [(Sub w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))])
# Check -- X - (C + Y) ==> -C + (X - Y)
# RUN: grep -A 3 \"# Query 24\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246\" %t2
# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Sub w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))])
# Check -- X - (Y + C) ==> -C + (X - Y)
# RUN: grep -A 3 \"# Query 25\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246\" %t2
# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Sub w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))])
# Check -- X - (C - Y) ==> -C + (X + Y)
# RUN: grep -A 3 \"# Query 26\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 246\" %t2
# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Sub w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))])
# Check -- X - (Y - C) ==> C + (X - Y)
# RUN: grep -A 3 \"# Query 27\" %t > %t2
# RUN: grep \"(query .. false .(Add w8 10\" %t2
# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2
(query [] false [(Sub w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))])
|