[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Global variables and ISRs ???
From: |
Galen Seitz |
Subject: |
Re: [avr-gcc-list] Global variables and ISRs ??? |
Date: |
Wed, 07 Sep 2005 08:51:36 -0700 |
Joerg Wunsch <address@hidden> wrote:
> "David Brown" <address@hidden> wrote:
>
> > ..., and it will also change "multiply by constant" into a series of
> > shifts and adds. The target chip has a hardware multiplier and
> > divider, but they are slower than the shift-and-add sequences.
>
> Unfortunately, AVR-GCC also does this, even though the hardware
> multiplier is faster than a series of shift and add. :-(
>
Because I wanted more control over multiplies, I've started creating
routines like these:
extern inline uint16_t
mult_u16_u8u8(uint8_t a, uint8_t b)
{
uint16_t product;
asm (
"mul %1, %2" "\n\t"
"movw %0, r0" "\n\t"
"clr r1" "\n\t"
: "=w" (product)
: "r" (a), "r" (b)
);
return product;
}
extern inline uint16_t
mult_u8h_u8u8(uint8_t a, uint8_t b)
{
uint8_t product_high;
asm (
"mul %1, %2" "\n\t"
"mov %0, r1" "\n\t"
"clr r1" "\n\t"
: "=w" (product_high)
: "r" (a), "r" (b)
);
return product_high;
}
I have a few others if people are interested.
galen
- Re: [avr-gcc-list] Global variables and ISRs ???, (continued)
- Re: [avr-gcc-list] Global variables and ISRs ???, Alex Wenger, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???, E. Weddington, 2005/09/08
- Re: [avr-gcc-list] Global variables and ISRs ???,
Galen Seitz <=
- Re: [avr-gcc-list] Global variables and ISRs ???, ericw, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Joerg Wunsch, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, David Brown, 2005/09/07
- Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07
Re: [avr-gcc-list] Global variables and ISRs ???, Vincent Trouilliez, 2005/09/07