Skip to content

Commit fa08e30

Browse files
author
Mohammad Rezaei
committed
test updates
1 parent 3e156bc commit fa08e30

4 files changed

Lines changed: 27 additions & 20 deletions

File tree

test/libevmasm/evmAssemblyTests/constant_optimizer_runs_0.asm

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ PUSH 0x2
2323
// PUSH0 NOT shift right:
2424
PUSH 0x3ffffffff
2525
PUSH 0x3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26+
// PUSH0 NOT shift left:
27+
PUSH 0xffffffffffffffffffffffffffff000000000000000000000000000000000000
28+
PUSH 0xffffff0000000000000000000000000000000000000000000000000000000000
2629
// PUSH0 NOT shift right then left:
2730
PUSH 0x1fffffffffffffffe0000000000000000000000000000000000000000000
2831
PUSH 0x7ffffffffffffff0000000000000000
@@ -57,17 +60,19 @@ PUSH 0x2
5760
// shl(0xe2, 0x0828703f)
5861
// not(0x00)
5962
// not(0x752f)
60-
// not(0xffffffff)
63+
// shl(0x20, not(0x00))
6164
// not(shl(0x40, 0xffffffff))
62-
// 0x03ffffffff
63-
// sub(shl(0xfa, 0x01), 0x01)
64-
// sub(shl(0xed, 0x01), shl(0xad, 0x01))
65-
// sub(shl(0x7b, 0x01), shl(0x40, 0x01))
66-
// add(shl(0xf0, 0x01), shl(0xac, 0x03))
67-
// add(shl(0x60, 0x100000000001), shl(0x2c, 0x01))
68-
// not(sub(shl(0x80, 0x0200000001), shl(0x40, 0x01)))
69-
// not(add(shl(0x80, 0xffffffff), 0xffffffff))
70-
// add(shl(0xea, 0x01deaf), 0x01)
65+
// shr(0xde, not(0x00))
66+
// shr(0x06, not(0x00))
67+
// shl(0x90, not(0x00))
68+
// shl(0xe8, not(0x00))
69+
// shl(0xad, shr(0xc0, not(0x00)))
70+
// shl(0x40, shr(0xc5, not(0x00)))
71+
// shl(0xac, or(0x03, shl(0x44, 0x01)))
72+
// shl(0x2c, or(0x01, shl(0x34, 0x100000000001)))
73+
// not(shl(0x40, or(shr(0xc0, not(0x00)), shl(0x61, 0x01))))
74+
// or(shl(0x20, shr(0xa0, not(0x00))), shl(0xa0, not(0x00)))
75+
// or(0x01, shl(0xea, 0x01deaf))
7176
// sub(shl(0x46, 0x01), 0x40)
7277
// sub(shl(0x40, 0x01), 0x20)
7378
// }

test/libevmasm/evmAssemblyTests/constant_optimizer_runs_200.asm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ PUSH 0x2
2121
// PUSH0 NOT shift right:
2222
PUSH 0x3ffffffff
2323
PUSH 0x3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
24+
// PUSH0 NOT shift left:
25+
PUSH 0xffffffffffffffffffffffffffff000000000000000000000000000000000000
26+
PUSH 0xffffff0000000000000000000000000000000000000000000000000000000000
2427
// PUSH0 NOT shift right then left:
2528
PUSH 0x1fffffffffffffffe0000000000000000000000000000000000000000000
2629
PUSH 0x7ffffffffffffff0000000000000000
@@ -56,14 +59,16 @@ PUSH 0x2
5659
// not(0xffffffff)
5760
// not(0xffffffff0000000000000000)
5861
// 0x03ffffffff
59-
// sub(shl(0xfa, 0x01), 0x01)
62+
// shr(0x06, not(0x00))
63+
// shl(0x90, not(0x00))
64+
// shl(0xe8, 0xffffff)
6065
// shl(0xad, 0xffffffffffffffff)
6166
// 0x07ffffffffffffff0000000000000000
6267
// shl(0xac, 0x100000000000000003)
6368
// 0x100000000001000000000000100000000000
6469
// not(0x0200000000ffffffffffffffff0000000000000000)
6570
// not(0xffffffff000000000000000000000000ffffffff)
66-
// add(shl(0xea, 0x01deaf), 0x01)
71+
// or(0x01, shl(0xea, 0x01deaf))
6772
// 0x3fffffffffffffffc0
6873
// 0xffffffffffffffe0
6974
// }

test/libevmasm/evmAssemblyTests/constant_optimizer_runs_2M.asm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ PUSH 0x2
2323
// PUSH0 NOT shift right:
2424
PUSH 0x3ffffffff
2525
PUSH 0x3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26+
// PUSH0 NOT shift left:
27+
PUSH 0xffffffffffffffffffffffffffff000000000000000000000000000000000000
28+
PUSH 0xffffff0000000000000000000000000000000000000000000000000000000000
2629
// PUSH0 NOT shift right then left:
2730
PUSH 0x1fffffffffffffffe0000000000000000000000000000000000000000000
2831
PUSH 0x7ffffffffffffff0000000000000000
@@ -61,6 +64,8 @@ PUSH 0x2
6164
// 0xffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff
6265
// 0x03ffffffff
6366
// 0x03ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
67+
// 0xffffffffffffffffffffffffffff000000000000000000000000000000000000
68+
// 0xffffff0000000000000000000000000000000000000000000000000000000000
6469
// 0x1fffffffffffffffe0000000000000000000000000000000000000000000
6570
// 0x07ffffffffffffff0000000000000000
6671
// 0x01000000000000000030000000000000000000000000000000000000000000

test/libsolidity/SolidityOptimizer.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,6 @@ BOOST_AUTO_TEST_CASE(computing_constants)
420420
++iter;
421421
}
422422
BOOST_CHECK_EQUAL(2, occurrences);
423-
424-
bytes constantWithZeros = toBigEndian(u256("0x77abc0000000000000000000000000000000000000000000000000000000001"));
425-
BOOST_CHECK(search(
426-
optimizedBytecode.cbegin(),
427-
optimizedBytecode.cend(),
428-
constantWithZeros.cbegin(),
429-
constantWithZeros.cend()
430-
) == optimizedBytecode.cend());
431423
}
432424

433425

0 commit comments

Comments
 (0)