avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] foo++, subi vs inc?


From: Sparr
Subject: Re: [avr-gcc-list] foo++, subi vs inc?
Date: Wed, 12 Nov 2008 17:38:38 -0500

An ubuntu bug is keeping me from [easily] working with the gcc source,
having that information when i finally do get started will save some
time.  I will experiment with finding out why it is picking subi
instead of inc, but I think inc should come ahead of subi in general,
so that's at least one thing I can put in a patch.

PS: is gccint.info a typo?

On Wed, Nov 12, 2008 at 4:51 PM, Marek Michalkiewicz
<address@hidden> wrote:
> The addqi3 pattern already has alternatives that use inc/dec - listed
> after the one using subi.  You could try to change the order so that
> "subi" is the last one and inc/dec is preferred, all else being equal.
> Not sure why this doesn't already work as expected in your case though,
> despite this paragraph from gccint.info:
>
>   If all the operands fit any one alternative, the instruction is valid.
>  Otherwise, for each alternative, the compiler counts how many
>  instructions must be added to copy the operands so that that
>  alternative applies.  The alternative requiring the least copying is
>  chosen.  If two alternatives need the same amount of copying, the one
>  that comes first is chosen.  These choices can be altered with the `?'
>  and `!' characters:
>
> Based on the above, it seems GCC thinks the two alternatives require the
> same amount of copying, even though subi may need more as it only works
> with r16-r31.  You could also experiment with putting `?' in the second
> alternative, to disparage "subi" slightly.
>
> Hope this helps,
> Marek
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]