[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] 16Bit arg in assembl. macro
From: |
Torsten Hahn |
Subject: |
[avr-gcc-list] 16Bit arg in assembl. macro |
Date: |
Wed, 17 Sep 2003 11:27:21 +0200 |
Hi,
i wanted to write an assembler macro, wich takes an uint16_t sized
Argument (two bytes) and returns two bytes (again an uint16_t) which
are computed by the macro.
i defined the macro like this:
#define randLCG(_seed_) ({ \
uint16_t __t; \
__asm__ __volatile__ ( \
"; some assembler code" \
: "=r" (__t) /* out */ \
: "r" ((uint16_t)(_seed_)) /* in */ \
: /* clobber */ \
); \
__t; \
})
where __t is the return value and the 16 bit _seed_ should go into 2
registers (selected by the compiler).
My question is now, is it possible to assign an 2 byte var like i have
done it to the register(s) and how do i reference them (%1 and %2 for
low/higbyte doesnt work)? Or do i have to break it into two one byte
vars manually ?
And than a second question. If i use code in my assembler macros which
clobbers registers r0 and r1 (multiplications), is it save if i only
add the two registers to the clobber-list or is there extra work to do?
--
Dipl. Nat. Torsten Hahn
Institut für Experimentelle Physik / TU Bergakademie Freiberg
mail: address@hidden
Tel.: +49 (0) 3731 392670
- [avr-gcc-list] 16Bit arg in assembl. macro,
Torsten Hahn <=