This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,avr] Adjust insn length of forward branches.


2016-08-01 10:56 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> The length computation of "branch" flavour insn length attribute computed a
> length one instruction too short, e.g. in the following test case:
>
> #define N0(N) if (X++ < N) __builtin_avr_nop()
>
> #define N1(N) N0(N);N0(N);N0(N);N0(N);N0(N);N0(N);N0(N);N0(N);N0(N);N0(N)
> #define N2(N) N1(N);N1(N);N1(N);N1(N);N1(N);N1(N);N1(N);N1(N);N1(N);N1(N)
> #define N3(N) N2(N);N2(N);N2(N);N2(N);N2(N);N2(N);N2(N);N2(N);N2(N);N2(N)
> #define N4(N) N3(N);N3(N);N3(N);N3(N);N3(N);N3(N);N3(N);N3(N);N3(N);N3(N)
>
> void bra_63 (unsigned char x)
> {
>     if (x > 0)
>     {
>         unsigned X = 0;
>         N4 (63);
>     }
> }
>
> void bra_2045 (unsigned char x)
> {
>     if (x > 0)
>     {
>         unsigned X = 0;
>         N4 (2045);
>     }
> }
>
> when compiled for MCU with JMP instruction like -mmcu=atmega168
>
> Ok to apply?
>
> Johann
>
>
>         * config/avr/avr.md (length) [branch]: Correct insn length
>         attribute for forward branches.

Please apply.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]