[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Clobber list isn't working

From: Gre7g Luterman
Subject: [avr-gcc-list] Clobber list isn't working
Date: Tue, 24 Jul 2007 15:53:36 -0700 (PDT)

I suppose I could be misunderstanding how the clobber
list of an inline asm statement is supposed to work,
but it doesn't seem to be working for me.  I specify
that I'm using r28 and r29, but the code following my
asm statement continues to use Y as if it was

To demonstrate, I've written the following (absurd)
block of code:

void test(void)
        int a, b, c, d, e, f;
    } x;

    x.d = 5;
    asm volatile("nop" : : : "r28", "r29");
    x.d = 6;

Obviously, the nop statement doesn't really clobber
r28 or r29, but my actual, far more complex code does.
 Regardless, gcc should be respecting the fact that I
told it I am clobbering these two registers.

$ avr-gcc.exe -v
Using built-in specs.
Target: avr
Configured with: ../gcc-4.1.1/configure
--prefix=/c/WinAVR --target=avr
--enable-languages=c,c++ --with-dwarf2
--enable-win32-registry=WinAVR --disable-nls
--disable-libssp --disable-fixincludes
--disable-libada --with-gnu-ld --with-gnu-as
Thread model: single
gcc version 4.1.1 (WinAVR 20070122)

$ avr-gcc.exe -mmcu=atmega8515 -c test.c -Wall
-gdwarf-2 -o test.o

$ avr-objdump.exe -S test.o
    x.d = 5;
  14:   85 e0           ldi     r24, 0x05       ; 5
  16:   90 e0           ldi     r25, 0x00       ; 0
  18:   98 87           std     Y+8, r25        ; 0x08
  1a:   8f 83           std     Y+7, r24        ; 0x07
    asm volatile("nop" : : : "r28", "r29");
  1c:   00 00           nop
    x.d = 6;
  1e:   86 e0           ldi     r24, 0x06       ; 6
  20:   90 e0           ldi     r25, 0x00       ; 0
  22:   98 87           std     Y+8, r25        ; 0x08
  24:   8f 83           std     Y+7, r24        ; 0x07

As you can see at 0x22 and 0x24, Y is getting used
without being reloaded after the nop at 0x1C.

I've tried using clobber lists of "Y", "y", and even
"r28,r29" in case it was a semantic thing, but gcc
errors out correctly on all of them.

Does anyone have a guess what it is that I'm missing?


Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]