[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #36611] _delay_loop_2 must not use constraint "w" wi
From: |
Cameron Tacklind |
Subject: |
[avr-libc-dev] [bug #36611] _delay_loop_2 must not use constraint "w" with all targets |
Date: |
Tue, 9 May 2017 21:45:08 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 |
Follow-up Comment #4, bug #36611 (project avr-libc):
I ran into this problem and just re-wrote the *__delay_loop_2_* assembly.
This should be equivalent for all AVRs. It should even take the same number of
clock cycles (since *_sbiw_* takes 2 clock cycles).
My initial tests suggest this is working. Since *___count_* is a 2 byte
number, *_%A0_* and *_%B0_* should always work as expected.
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
"1: subi %A0,1" "\n\t"
"sbci %B0,0" "\n\t"
"brne 1b"
: "=d" (__count)
: "0" (__count)
);
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?36611>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] [bug #36611] _delay_loop_2 must not use constraint "w" with all targets,
Cameron Tacklind <=