diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-10-12 16:18:43 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-11-10 16:48:47 +0100 |
| commit | 5e9ef3b5c45f0f384519a3784f62ac2a758781d4 (patch) | |
| tree | f7059c71bbde19332b66f235455fa33eb701922f /test/expression/simplifications.py | |
| parent | 7ca62062fe1321c4b151a53530423952b5535d10 (diff) | |
| download | miasm-5e9ef3b5c45f0f384519a3784f62ac2a758781d4.tar.gz miasm-5e9ef3b5c45f0f384519a3784f62ac2a758781d4.zip | |
Simple: add multiplication simplification
Diffstat (limited to 'test/expression/simplifications.py')
| -rw-r--r-- | test/expression/simplifications.py | 20 |
1 files changed, 19 insertions, 1 deletions
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<<i1) - a, a), + ((a<<i1) - (a<<i2), a*im2), + ((a<<i1) - a - a, i0), + ((a<<i2) - (a<<i1) - (a<<i1), i0), + ((a<<i2) - a*i3, a), + (((a+b) * i3) - (a + b), (a+b) * i2), + (((a+b) * i2) + a + b, (a+b) * i3), + (((a+b) * i3) - a - b, (a+b) * i2), + (((a+b) * i2) - a - b, a+b), + (((a+b) * i2) - i2 * a - i2 * b, i0), + ] |