public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/42516]  New: [m68k] Suboptimal halfword swap on coldfire
@ 2009-12-27 16:53 nizze86 at hotmail dot com
  2009-12-27 17:19 ` [Bug target/42516] " schwab at linux-m68k dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nizze86 at hotmail dot com @ 2009-12-27 16:53 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/42516] [m68k] Suboptimal halfword swap on coldfire
  2009-12-27 16:53 [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire nizze86 at hotmail dot com
@ 2009-12-27 17:19 ` schwab at linux-m68k dot org
  2009-12-27 20:05 ` mkuvyrkov at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: schwab at linux-m68k dot org @ 2009-12-27 17:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at linux-m68k dot org  2009-12-27 17:19 -------
This is part of the rotlsi3 pattern which is disabled for coldfire since it
does not have rotate insns.


-- 

schwab at linux-m68k dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|amd64-unknown-linux         |
 GCC target triplet|m68k-elf                    |m68k-*-*
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-27 17:19:24
               date|                            |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/42516] [m68k] Suboptimal halfword swap on coldfire
  2009-12-27 16:53 [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire nizze86 at hotmail dot com
  2009-12-27 17:19 ` [Bug target/42516] " schwab at linux-m68k dot org
@ 2009-12-27 20:05 ` mkuvyrkov at gcc dot gnu dot org
  2009-12-30 23:04 ` schwab at gcc dot gnu dot org
  2009-12-30 23:05 ` schwab at linux-m68k dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mkuvyrkov at gcc dot gnu dot org @ 2009-12-27 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mkuvyrkov at gcc dot gnu dot org  2009-12-27 20:05 -------
Thanks for the bug report.  I've posted a proposed patch in
http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01142.html.


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/42516] [m68k] Suboptimal halfword swap on coldfire
  2009-12-27 16:53 [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire nizze86 at hotmail dot com
  2009-12-27 17:19 ` [Bug target/42516] " schwab at linux-m68k dot org
  2009-12-27 20:05 ` mkuvyrkov at gcc dot gnu dot org
@ 2009-12-30 23:04 ` schwab at gcc dot gnu dot org
  2009-12-30 23:05 ` schwab at linux-m68k dot org
  3 siblings, 0 replies; 5+ messages in thread
From: schwab at gcc dot gnu dot org @ 2009-12-30 23:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from schwab at gcc dot gnu dot org  2009-12-30 23:03 -------
Subject: Bug 42516

Author: schwab
Date: Wed Dec 30 23:03:46 2009
New Revision: 155527

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155527
Log:
PR target/42516
* config/m68k/m68k.md (rotlsi_16): New insn.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/m68k/m68k.md


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/42516] [m68k] Suboptimal halfword swap on coldfire
  2009-12-27 16:53 [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire nizze86 at hotmail dot com
                   ` (2 preceding siblings ...)
  2009-12-30 23:04 ` schwab at gcc dot gnu dot org
@ 2009-12-30 23:05 ` schwab at linux-m68k dot org
  3 siblings, 0 replies; 5+ messages in thread
From: schwab at linux-m68k dot org @ 2009-12-30 23:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from schwab at linux-m68k dot org  2009-12-30 23:04 -------
Fixed.


-- 

schwab at linux-m68k dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-30 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-27 16:53 [Bug target/42516] New: [m68k] Suboptimal halfword swap on coldfire nizze86 at hotmail dot com
2009-12-27 17:19 ` [Bug target/42516] " schwab at linux-m68k dot org
2009-12-27 20:05 ` mkuvyrkov at gcc dot gnu dot org
2009-12-30 23:04 ` schwab at gcc dot gnu dot org
2009-12-30 23:05 ` schwab at linux-m68k dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).