about summary refs log tree commit diff homepage
path: root/test/Expr/Parser/Simplify.pc
blob: 1a853b163eede0106e743f2b4eab85e90be39696 (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
# RUN: %kleaver --builder=simplify -print-ast %s > %t

array a[64] : w32 -> w8 = symbolic

# Check -- X u> Y ==> Y u< X
# RUN: grep -A 2 \"# Query 1\" %t > %t2
# RUN: grep \"(query .. false .(Ult (Read w8 1 a) (Read w8 0 a)).)\" %t2
(query [] false [(Ugt (Read w8 0 a) (Read w8 1 a))])

# Check -- X u>= Y ==> Y u<= X
# RUN: grep -A 2 \"# Query 2\" %t > %t2
# RUN: grep \"(query .. false .(Ule (Read w8 1 a) (Read w8 0 a)).)\" %t2
(query [] false [(Uge (Read w8 0 a) (Read w8 1 a))])

# Check -- X u> Y ==> Y u< X
# RUN: grep -A 2 \"# Query 3\" %t > %t2
# RUN: grep \"(query .. false .(Slt (Read w8 1 a) (Read w8 0 a)).)\" %t2
(query [] false [(Sgt (Read w8 0 a) (Read w8 1 a))])

# Check -- X u>= Y ==> Y u<= X
# RUN: grep -A 2 \"# Query 4\" %t > %t2
# RUN: grep \"(query .. false .(Sle (Read w8 1 a) (Read w8 0 a)).)\" %t2
(query [] false [(Sge (Read w8 0 a) (Read w8 1 a))])

# Check -- X != Y ==> !(X == Y)
# RUN: grep -A 2 \"# Query 5\" %t > %t2
# RUN: grep \"(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)\" %t2
(query [] false [(Ne (Read w8 0 a) (Read w8 1 a))])

# Check -- !(X or Y) ==> !X and !Y
# RUN: grep -A 3 \"# Query 6$\" %t > %t2
# RUN: grep \"(query .. false .(And (Not (Eq 0 (Read w8 0 a)))\" %t2
# RUN: grep                       \"(Not (Eq 1 (Read w8 1 a))))\" %t2
(query [] false [(Not (Or (Eq 0 (Read w8 0 a))
                          (Eq 1 (Read w8 1 a))))])

# Check -- false == X ==> !X
# RUN: grep -A 2 \"# Query 7\" %t > %t2
# RUN: grep \"(query .. false .(Not (Extract 1 (Read w8 0 a))).)\" %t2
(query [] false [(Eq (Extract w1 1 (Read w8 0 a)) false)])