public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/43676]  New: [m68k] Wrong code due to missing sign extension
@ 2010-04-07 15:01 nizze86 at hotmail dot com
  2010-04-07 15:03 ` [Bug target/43676] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: nizze86 at hotmail dot com @ 2010-04-07 15:01 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 saturate.c -mcpu=5249 -O1 -S)

int saturate(int x)
{
    return (x == (short)x ? x : (x >> 31) ^ 0x7FFF);
}

gcc produces:
saturate:
        link.w %fp,#0
        move.l 8(%fp),%d0
        move.w %d0,%a0
        cmp.l %a0,%d0
        jeq .L2
        add.l %d0,%d0
        subx.l %d0,%d0
        eor.l #32767,%d0
.L2:
        unlk %fp
        rts

Where a0 is compared to d0 without a sign extension so the upper half of a0
remtains whatever was already there.

This is with gcc:
4.5.0 20100401 (experimental) (GCC) 

configured with:
--target=m68k-elf --prefix=/usr/local --enable-languages=c --disable-libssp
--with-arch=cf --with-cpu=5249

Also observed with gcc 3.4.6 so likely not a regression.


-- 
           Summary: [m68k] Wrong code due to missing sign extension
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nizze86 at hotmail dot com
GCC target triplet: m68k-elf-*


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


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

* [Bug target/43676] [m68k] Wrong code due to missing sign extension
  2010-04-07 15:01 [Bug target/43676] New: [m68k] Wrong code due to missing sign extension nizze86 at hotmail dot com
@ 2010-04-07 15:03 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-04-07 15:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-04-07 15:03 -------


*** This bug has been marked as a duplicate of 43675 ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-04-07 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07 15:01 [Bug target/43676] New: [m68k] Wrong code due to missing sign extension nizze86 at hotmail dot com
2010-04-07 15:03 ` [Bug target/43676] " rguenth at gcc dot gnu 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).