>Number: 9663 >Category: target >Synopsis: gcc-20030127 misses an optimization opportunity >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Tue Feb 11 17:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Tamás Gergely >Release: gcc version 3.3 20030127 (prerelease) >Organization: >Environment: Built on: Linux 2.4.20 i686 unknown Configured with: /home/gertom/gcc/src/gcc-20030127/configure --target=arm-elf --prefix=/home/gertom/gcc/build/install-20030127-arm-elf-orgn --enable-target-optspace --with-newlib --with-headers --disable-nls --disable-threads --disable-shared --disable-libgcj --disable-multilib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ Thread model: single >Description: The following two lines: cmp r0, #0 mov lr, r0 should be replaced with: subs lr, r0, #0 in the asm output. 20020503-1.i: --- # 1 "20020503-1.c" # 1 "" # 1 "" # 1 "20020503-1.c" void abort (void); static char * inttostr (long i, char buf[128]) { unsigned long ui = i; char *p = buf + 127; *p = '\0'; if (i < 0) ui = -ui; do *--p = '0' + ui % 10; while ((ui /= 10) != 0); if (i < 0) *--p = '-'; return p; } int main () { char buf[128], *p; p = inttostr (-1, buf); if (*p != '-') abort (); return 0; } >How-To-Repeat: just compile with -O2 >Fix: See "PATCH: new peephole2 in arm.md" at http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00204.html >Release-Note: >Audit-Trail: >Unformatted: