This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/39819] [avr] Missed optimisation when setting 4-byte values


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39819

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |gjl at gcc dot gnu.org
      Known to work|                            |4.6.1
         Resolution|                            |WONTFIX

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-02 21:23:59 UTC ---
Closed as WONTFIX.

Compiled the following code in 4.6.1, -std=c99 -mmcu=atmega88 -Os

typedef unsigned char uint8_t;
typedef unsigned long int uint32_t;

uint8_t as[4];
uint8_t bs[4];
static const uint8_t sz = 4;

void foo1(void) {
    for (uint8_t i = 0; i < sz; i++) {
        bs[i] = as[1];
    }
}

void foo2(void) {
    for (uint8_t i = 0; i < sz; i++) {
        *(bs + i) = *(as + 1);
    }
}

The result is:

foo1:
    lds r24,as+1
    sts bs,r24
    sts bs+1,r24
    sts bs+2,r24
    sts bs+3,r24
    ret

foo2:
    lds r24,as+1
    sts bs,r24
    sts bs+1,r24
    sts bs+2,r24
    sts bs+3,r24
    ret

So the difference has gone.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]