about summary refs log tree commit diff stats
path: root/test/expression/simplifications.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2018-02-13 14:46:18 +0100
committerAjax <commial@gmail.com>2018-02-14 12:14:07 +0100
commitc887ab5c5da2c12ccb84be93da238a9c9be3e229 (patch)
tree13ec520246b674dcb4880fe8e3213ca4442a2662 /test/expression/simplifications.py
parent0056026fa2f07b49d54236148ad5c528b18b381f (diff)
downloadmiasm-c887ab5c5da2c12ccb84be93da238a9c9be3e229.tar.gz
miasm-c887ab5c5da2c12ccb84be93da238a9c9be3e229.zip
A >> X >> Y => A >> (X+Y) ONLY IF X + Y does not overflow
Diffstat (limited to 'test/expression/simplifications.py')
-rw-r--r--test/expression/simplifications.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index 8799191b..5a223f7c 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -77,6 +77,9 @@ d = ExprId('d', 32)
 e = ExprId('e', 32)
 f = ExprId('f', size=64)
 
+b_msb_null = b[:31].zeroExtend(32)
+c_msb_null = c[:31].zeroExtend(32)
+
 m = ExprMem(a)
 s = a[:8]
 
@@ -377,6 +380,12 @@ to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)),
     ((ExprMem(ExprCond(a, b, c)),ExprCond(a, ExprMem(b), ExprMem(c)))),
     (ExprCond(a, i0, i1) + ExprCond(a, i0, i1), ExprCond(a, i0, i2)),
 
+    (a << b << c, a << b << c), # Left unmodified
+    (a << b_msb_null << c_msb_null,
+     a << (b_msb_null + c_msb_null)),
+    (a >> b >> c, a >> b >> c), # Left unmodified
+    (a >> b_msb_null >> c_msb_null,
+     a >> (b_msb_null + c_msb_null)),
 ]
 
 for e_input, e_check in to_test: