This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,avr] Adjust insn length of forward branches.
- From: Denis Chertykov <chertykov at gmail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Aug 2016 14:51:43 +0300
- Subject: Re: [patch,avr] Adjust insn length of forward branches.
- Authentication-results: sourceware.org; auth=none
- References: <0d7ed392-fb6f-6404-15e6-9377acbab72c@gjlay.de>
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.