Skip to content

Commit 0f41f22

Browse files
chfastCarsons-Eels
authored andcommitted
feat(tests/zkevm): add two more benchmarks for DIV and SDIV (ethereum#1708)
1 parent 7583fab commit 0f41f22

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/zkevm/test_worst_compute.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,18 +849,38 @@ def test_worst_jumpdests(
849849
(
850850
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F,
851851
# We want the first divisor to be slightly bigger than 2**128:
852-
# this is the worst case for the division algorithm.
852+
# this is the worst case for the division algorithm with optimized paths
853+
# for division by 1 and 2 words.
853854
0x100000000000000000000000000000033,
854855
),
855856
),
856857
(
857-
# Same as DIV, but the numerator made positive, and the divisor made negative.
858+
# This has the cycle of 2, see above.
859+
Op.DIV,
860+
(
861+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F,
862+
# We want the first divisor to be slightly bigger than 2**64:
863+
# this is the worst case for the division algorithm with an optimized path
864+
# for division by 1 word.
865+
0x10000000000000033,
866+
),
867+
),
868+
(
869+
# Same as DIV-0, but the numerator made positive, and the divisor made negative.
858870
Op.SDIV,
859871
(
860872
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F,
861873
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCD,
862874
),
863875
),
876+
(
877+
# Same as DIV-1, but the numerator made positive, and the divisor made negative.
878+
Op.SDIV,
879+
(
880+
0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F,
881+
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFCD,
882+
),
883+
),
864884
(
865885
# This scenario is not suitable for MOD because the values quickly become 0.
866886
Op.MOD,

0 commit comments

Comments
 (0)