From 5e9ef3b5c45f0f384519a3784f62ac2a758781d4 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Fri, 12 Oct 2018 16:18:43 +0200 Subject: Simple: add multiplication simplification --- test/expression/simplifications.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/expression') diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index 741d6adb..57895510 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -97,7 +97,10 @@ s = a[:8] i0 = ExprInt(0, 32) i1 = ExprInt(1, 32) i2 = ExprInt(2, 32) +i3 = ExprInt(3, 32) im1 = ExprInt(-1, 32) +im2 = ExprInt(-2, 32) + icustom = ExprInt(0x12345678, 32) cc = ExprCond(a, b, c) @@ -242,7 +245,7 @@ to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)), (ExprOp('*', -a, -b, c, ExprInt(0x12, 32)), ExprOp('*', a, b, c, ExprInt(0x12, 32))), (ExprOp('*', -a, -b, -c, ExprInt(0x12, 32)), - - ExprOp('*', a, b, c, ExprInt(0x12, 32))), + ExprOp('*', a, b, c, ExprInt(-0x12, 32))), (a | ExprInt(0xffffffff, 32), ExprInt(0xffffffff, 32)), (ExprCond(a, ExprInt(1, 32), ExprInt(2, 32)) * ExprInt(4, 32), @@ -443,6 +446,21 @@ to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)), (ExprOp("signExt_16", ExprInt(0x8, 8)), ExprInt(0x8, 16)), (ExprOp("signExt_16", ExprInt(-0x8, 8)), ExprInt(-0x8, 16)), + (- (i2*a), a * im2), + (a + a, a * i2), + (ExprOp('+', a, a), a * i2), + (ExprOp('+', a, a, a), a * i3), + ((a<