[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] possible 4.1.2 bug
From: |
Eric Weddington |
Subject: |
RE: [avr-gcc-list] possible 4.1.2 bug |
Date: |
Wed, 28 Mar 2007 22:35:55 -0600 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of John Regehr
> Sent: Wednesday, March 28, 2007 10:15 PM
> To: address@hidden
> Subject: [avr-gcc-list] possible 4.1.2 bug
>
>
> void foo (char, char, char, char, char);
>
> short bar (void)
> {
> char a = 0;
> volatile char b = 0;
> char c = 0;
> char d = 0;
> char e = 0;
> int in;
> int out;
>
> foo (e, d, c, b, a);
>
> __asm__ ("swap %B1 \n\t"
> "swap %C1 \n\t"
> "swap %D1 \n\t"
> "ldi %A1, 0xf0 \n\t"
> "eor %D1, %C1 \n\t"
> "and %D1, %A1 \n\t"
> "eor %D1, %C1 \n\t"
> "eor %C1, %B1 \n\t"
> "and %C1, %A1 \n\t"
> "eor %C1, %B1 \n\t"
> "movw %A0, %C1 \n\t"
> : "=&r" (out) : "r" (in));
>
> return out;
> }
Besides what Joerg wrote, I'm puzzled about the above inline assembly. This
code uses 4 parts (bytes), A through D, as if "in" was a 32-bit value. But
both variables, out and in, are defined to be int, which on an AVR are 16
bits. Either there's a descrepency here, or I'm just not understanding
what's going on here.
Eric