[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Is it possible to implement...
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] Is it possible to implement... |
Date: |
Mon, 6 Jan 2003 10:15:43 +0100 (MET) |
address@hidden wrote:
> I am not (yet) a user of avr-gcc but I would assume the compiler is
> internally optimized for 16/8 bit adds and thus would already
> implement 16 bits adds optimized as you describe.
Yes, it does:
$ /usr/local/lib/gcc-lib/avr/3.3/cc1 -quiet -O -o -
int foo(int c) { extern int i; i += c; return i; }
^D
.file "<stdin>"
.arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
.text
.global foo
.type foo, @function
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
lds r18,i
lds r19,(i)+1
add r24,r18
adc r25,r19
sts (i)+1,r25
sts i,r24
/* epilogue: frame size=0 */
ret
/* epilogue end (size=1) */
/* function foo size 11 (10) */
.size foo, .-foo
/* File "<stdin>": code 11 = 0x000b ( 10), prologues 0, epilogues 1 */
Well, if the increment is constant, it can use "adiw" instead.
--
J"org Wunsch Unix support engineer
address@hidden http://www.interface-systems.de/~j/
avr-gcc-list at http://avr1.org