On Wed, Mar 19, 2014 at 03:50:47PM +0100, Georg-Johann Lay wrote: > Am 03/18/2014 06:33 PM, schrieb Senthil Kumar Selvaraj: > >Hi, > > > >I see that the avr_rtx_costs_1 function returns relative costs for a > >variety of RTL codes, but only for non-DImode operands. For DImode, > >it returns false, and gcc uses its idea of the cost plus the costs of > >operands (found by recursing into the RTL expression) instead. > > > >Is there a reason why this has not been done? > > > >I was trying to debug compilation timeouts in the latest trunk test > >results (http://gcc.gnu.org/ml/gcc-testresults/2014-03/msg01239.html) > >- specifically > >WARNING: program timed out. > >FAIL: gcc.c-torture/execute/20041011-1.c compilation, -O1 > > I cannot reproduce this all 22 tests from execute.exp=20041011-1.c take > around 6 seconds (including test suite overhead). > > >and found that expmed.c:choose_mult_variant takes a lot of time to > >finish if a DImode value of -513 is provided. From my initial > >analysis, it looks like it has to do with cost values being off for > >DImode RTL operations (making MULT in avr_rtx_costs_1 to return > >twice the cost of SImode for DImode fixed the timeout). Has > >someone seen or fixed something like this before? > > No. Even if the choice of a particular MUL strategy is not optimal, it > should not hang the compiler. I suspect you are using a 64-bit host? (I am > on 32 bit Linux). > That's right - I'm running the compiler on an amd64 machine. I see a bunch of HOST_WIDE_INTs being used in choose_mult_variant and its calleesm. -513 is treated as an unsigned HOST_WIDE_INT, and the (recursive) call stack of synth_mult calls is ~30 frames deep in my machine (see attached backtrace below).
And oh, the time consuming part is *deciding* on the choice of algorithm to do the multiplication, not the RTL/code generation part. Regards Senthil avr_rtx_costs[t2:expand(175)]=true (speed) total=0, outer=mult: (const_int -513 [0xfffffffffffffdff]) ^C Program received signal SIGINT, Interrupt. 0x0000000000715ab0 in synth_mult (alg_out=alg_out@entry=0x7fffffffbe30, t=t@entry=3134019, cost_limit=cost_limit@entry=0x7fffffffbf00, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2714 2714 if (t % d == 0 && t > d && m < maxm (gdb) bt #0 0x0000000000715ab0 in synth_mult (alg_out=alg_out@entry=0x7fffffffbe30, t=t@entry=3134019, cost_limit=cost_limit@entry=0x7fffffffbf00, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2714 #1 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffbf90, t=6268037, cost_limit=cost_limit@entry=0x7fffffffc060, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #2 0x00000000007160f0 in synth_mult (alg_out=alg_out@entry=0x7fffffffc0f0, t=t@entry=94020555, cost_limit=cost_limit@entry=0x7fffffffc1c0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2734 #3 0x0000000000715798 in synth_mult (alg_out=alg_out@entry=0x7fffffffc250, t=376082220, cost_limit=cost_limit@entry=0x7fffffffc320, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2525 #4 0x0000000000715faa in synth_mult (alg_out=alg_out@entry=0x7fffffffc3b0, t=t@entry=12410713260, cost_limit=cost_limit@entry=0x7fffffffc480, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2695 #5 0x0000000000715cbf in synth_mult (alg_out=alg_out@entry=0x7fffffffc510, t=t@entry=12410713259, cost_limit=cost_limit@entry=0x7fffffffc5e0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2598 #6 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffc670, t=t@entry=99285706071, cost_limit=cost_limit@entry=0x7fffffffc740, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #7 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffc7d0, t=t@entry=397142824283, cost_limit=cost_limit@entry=0x7fffffffc8a0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #8 0x0000000000715798 in synth_mult (alg_out=alg_out@entry=0x7fffffffc930, t=t@entry=3177142594264, cost_limit=cost_limit@entry=0x7fffffffca00, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2525 #9 0x00000000007159c0 in synth_mult (alg_out=alg_out@entry=0x7fffffffca90, t=3177142594265, cost_limit=cost_limit@entry=0x7fffffffcb60, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2618 #10 0x0000000000715faa in synth_mult (alg_out=alg_out@entry=0x7fffffffcbf0, t=t@entry=15885712971325, cost_limit=cost_limit@entry=0x7fffffffccc0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2695 #11 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffcd50, t=31771425942649, cost_limit=cost_limit@entry=0x7fffffffce20, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #12 0x00000000007160f0 in synth_mult (alg_out=alg_out@entry=0x7fffffffceb0, t=t@entry=95314277827947, cost_limit=cost_limit@entry=0x7fffffffcf80, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2734 #13 0x0000000000715798 in synth_mult (alg_out=alg_out@entry=0x7fffffffd010, t=381257111311788, cost_limit=cost_limit@entry=0x7fffffffd0e0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2525 #14 0x0000000000715faa in synth_mult (alg_out=alg_out@entry=0x7fffffffd170, t=t@entry=3431314001806092, cost_limit=cost_limit@entry=0x7fffffffd240, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2695 #15 0x00000000007159c0 in synth_mult (alg_out=alg_out@entry=0x7fffffffd2d0, t=t@entry=3431314001806093, cost_limit=cost_limit@entry=0x7fffffffd3a0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2618 #16 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffd430, t=t@entry=6862628003612185, cost_limit=cost_limit@entry=0x7fffffffd500, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #17 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffd590, t=t@entry=13725256007224369, cost_limit=cost_limit@entry=0x7fffffffd660, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #18 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffd6f0, t=27450512014448737, cost_limit=cost_limit@entry=0x7fffffffd7c0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #19 0x00000000007160f0 in synth_mult (alg_out=alg_out@entry=0x7fffffffd850, t=t@entry=82351536043346211, cost_limit=cost_limit@entry=0x7fffffffd920, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2734 #20 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffd9b0, t=t@entry=164703072086692421, cost_limit=cost_limit@entry=0x7fffffffda80, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #21 0x0000000000716365 in synth_mult (alg_out=alg_out@entry=0x7fffffffdb10, t=t@entry=329406144173384841, cost_limit=cost_limit@entry=0x7fffffffdbe0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2792 #22 0x0000000000715798 in synth_mult (alg_out=alg_out@entry=0x7fffffffdc70, t=t@entry=2635249153387078728, cost_limit=cost_limit@entry=0x7fffffffdd40, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2525 #23 0x00000000007159c0 in synth_mult (alg_out=alg_out@entry=0x7fffffffddd0, t=2635249153387078729, cost_limit=cost_limit@entry=0x7fffffffdea0, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2618 #24 0x00000000007160f0 in synth_mult (alg_out=alg_out@entry=0x7fffffffe000, t=t@entry=18446744073709551103, cost_limit=cost_limit@entry=0x7fffffffdf10, mode=mode@entry=DImode) at /scratch/code/git/gcc/gcc/expmed.c:2734 #25 0x0000000000716523 in choose_mult_variant (mode=mode@entry=DImode, val=val@entry=-513, alg=alg@entry=0x7fffffffe000, variant=variant@entry=0x7fffffffdfdc, mult_cost=1280) at /scratch/code/git/gcc/gcc/expmed.c:2887 <snip> _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list