https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87256

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Can be reproduced on x86_64-linux on the same testcase, just put a breakpoint
on
synth_mult and
(gdb) set var t = -8796714831421723037
(gdb) set cost_limit->cost = 128
(gdb) set cost_limit->latency = 128
there is quite a recursion.  Or even on
unsigned long long foo (unsigned long long x) { return x *
-8796714831421723037LL; }
with -O2 and the same manually bumped cost/latency on the outermost synth_mult.
If I instrument synth_mult, in this case there are 4897996 calls to synth_mult,
different counts at various levels of synth_mult recursion (first number is
number of synth_mult callers of synth_mult, the second number how many such
synth_mult calls have been made):
0 2
1 5
2 16
3 36
4 98
5 231
6 528
7 1112
8 2127
9 4007
10 7492
11 13147
12 22400
13 36880
14 59282
15 93213
16 141522
17 201388
18 271570
19 359030
20 440279
21 505613
22 571884
23 587240
24 518362
25 409409
26 299289
27 195388
28 102828
29 40657
30 10932
31 1897
32 132

In any case, with very small cost of addition and shifts and extremely high
cost and latency of multiplication, we seem to spend way too much trying to
find an optimal synthetic multiplication sequence.

Reply via email to