From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21794 invoked by alias); 27 Dec 2009 16:53:17 -0000 Received: (qmail 21755 invoked by uid 48); 27 Dec 2009 16:53:06 -0000 Date: Sun, 27 Dec 2009 16:53:00 -0000 Subject: [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "nizze86 at hotmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-12/txt/msg02503.txt.bz2 When compiling the following function for a coldfire target, such as mcf5249: (using the following command line m68k-elf-gcc hswap.c -mcpu=5249 -S -O2) unsigned hswap(unsigned x) { return (x << 16) | (x >> 16); } gcc produces: hswap: link.w %fp,#0 move.l 8(%fp),%d1 move.l %d1,%d0 clr.w %d0 swap %d0 swap %d1 clr.w %d1 or.l %d1,%d0 unlk %fp rts Optimization level affects only instr ordering. the same function compiled for 68020 (using the following command line m68k-elf-gcc hswap.c -mcpu=68020 -S -O2) hswap: link.w %fp,#0 move.l 8(%fp),%d0 swap %d0 unlk %fp rts which is valid code for the coldfire target too and much smaller and faster this is using gcc 4.4.2 configured with --enable-languages=c --disable-libssp --with-arch=cf --with-cpu=5249 the same behaviour is present in gcc 3.4.6 too. -- Summary: [m68k] Suboptimal halfword swap on coldfire Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nizze86 at hotmail dot com GCC host triplet: amd64-unknown-linux GCC target triplet: m68k-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42516