public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/41015]  New: [4.4 Regression] SH: miscompilation for sh4-linux
@ 2009-08-09 16:26 sugioka at itonet dot co dot jp
  2009-08-09 16:28 ` [Bug target/41015] " sugioka at itonet dot co dot jp
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sugioka at itonet dot co dot jp @ 2009-08-09 16:26 UTC (permalink / raw)
  To: gcc-bugs

glibc-2.10.1 is not correctly compiled with gcc-4.4.1 for sh4-linux.
I attached preproccessed code.

Reproduce: sh4-linux-gcc -O2 -fPIC -S strtod_l.i

Wrong part is as follows.
.L453:
        mov     #64,r13
        tst     r9,r9           !!
        add     r14,r13
        mov.l   @(4,r13),r0
#APP
! 1306 "strtod_l.c" 1
        mov r11,r5              !! udiv_qrnnd macro
        swap.w r7,r4
        swap.w r5,r6
        jsr @r10                ! call __udiv_qrnnd_16
        shll16 r6
        swap.w r4,r4
        jsr @r10                ! call __udiv_qrnnd_16
        swap.w r1,r8
        or r1,r8
! 0 "" 2
#NO_APP
        bf/s    .L323
        mov.l   r0,@(4,r13)

In this code, "tst r9,r9" is moved to wrong place as if
"t" bit is not clobbered in __udiv_qrnnd_16.

I guessed that missing "t" bit constraint in udiv_qrnnd macro
caused this problem. So I tried following patch, but there was
no effect.

Index: gcc/longlong.h
===================================================================
--- gcc/longlong.h      (revision 150591)
+++ gcc/longlong.h      (working copy)
@@ -982,7 +982,7 @@
 "      or r1,%0"                                                       \
        : "=r" (q), "=&z" (r)                                           \
        : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16)          \
-       : "r1", "r2", "r4", "r5", "r6", "pr");                          \
+       : "r1", "r2", "r4", "r5", "r6", "pr", "t");                     \
   } while (0)

 #define UDIV_TIME 80


-- 
           Summary: [4.4 Regression] SH: miscompilation for sh4-linux
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp


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


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

* [Bug target/41015] [4.4 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
@ 2009-08-09 16:28 ` sugioka at itonet dot co dot jp
  2009-08-09 22:44 ` [Bug target/41015] [4.4/4.5 " kkojima at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sugioka at itonet dot co dot jp @ 2009-08-09 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sugioka at itonet dot co dot jp  2009-08-09 16:28 -------
Created an attachment (id=18330)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18330&action=view)
preprocessed source


-- 


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
  2009-08-09 16:28 ` [Bug target/41015] " sugioka at itonet dot co dot jp
@ 2009-08-09 22:44 ` kkojima at gcc dot gnu dot org
  2009-08-10  4:47 ` sugioka at itonet dot co dot jp
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-08-09 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kkojima at gcc dot gnu dot org  2009-08-09 22:44 -------
I've confirmed that 4.5 has the same problem and 4.3 doesn't.

> In this code, "tst r9,r9" is moved to wrong place as if
> "t" bit is not clobbered in __udiv_qrnnd_16.
> 
> I guessed that missing "t" bit constraint in udiv_qrnnd macro
> caused this problem. So I tried following patch, but there was
> no effect.

I think you are right.  Also your patch solves the problem in my
tests.  Did you make strtod_l.i change as your patch does for
longlong.h?


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.4.1 4.5.0
      Known to work|                            |4.3.4
           Priority|P3                          |P4
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-09 22:44:43
               date|                            |
            Summary|[4.4 Regression] SH:        |[4.4/4.5 Regression] SH:
                   |miscompilation for sh4-linux|miscompilation for sh4-linux


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
  2009-08-09 16:28 ` [Bug target/41015] " sugioka at itonet dot co dot jp
  2009-08-09 22:44 ` [Bug target/41015] [4.4/4.5 " kkojima at gcc dot gnu dot org
@ 2009-08-10  4:47 ` sugioka at itonet dot co dot jp
  2009-08-10  5:08 ` kkojima at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sugioka at itonet dot co dot jp @ 2009-08-10  4:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from sugioka at itonet dot co dot jp  2009-08-10 04:47 -------
I found that there is a copy of longlong.h in glibc/stdlib.
After fixing it, it worked.


-- 


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
                   ` (2 preceding siblings ...)
  2009-08-10  4:47 ` sugioka at itonet dot co dot jp
@ 2009-08-10  5:08 ` kkojima at gcc dot gnu dot org
  2009-08-10 20:58 ` kkojima at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-08-10  5:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2009-08-10 05:08 -------
Ah, I see.  Could you please send that patch to libc list?
I'll fix gcc/longlong.h on gcc trunk and 4.4 branch after
the usual tests.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |sh*-*-*


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
                   ` (3 preceding siblings ...)
  2009-08-10  5:08 ` kkojima at gcc dot gnu dot org
@ 2009-08-10 20:58 ` kkojima at gcc dot gnu dot org
  2009-08-11 22:37 ` kkojima at gcc dot gnu dot org
  2009-08-11 22:38 ` kkojima at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-08-10 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2009-08-10 20:57 -------
Subject: Bug 41015

Author: kkojima
Date: Mon Aug 10 20:57:35 2009
New Revision: 150635

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150635
Log:
        PR target/41015
        * longlong.h [__sh__] (udiv_qrnnd): Add T register to clobber list.
        (sub_ddmmss): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/longlong.h


-- 


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
                   ` (4 preceding siblings ...)
  2009-08-10 20:58 ` kkojima at gcc dot gnu dot org
@ 2009-08-11 22:37 ` kkojima at gcc dot gnu dot org
  2009-08-11 22:38 ` kkojima at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-08-11 22:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kkojima at gcc dot gnu dot org  2009-08-11 22:37 -------
Subject: Bug 41015

Author: kkojima
Date: Tue Aug 11 22:36:56 2009
New Revision: 150667

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150667
Log:
        Backport from mainline:
        2009-08-10  SUGIOKA Toshinobu  <sugioka@itonet.co.jp>

        PR target/41015
        * longlong.h [__sh__] (udiv_qrnnd): Add T register to clobber list.
        (sub_ddmmss): Likewise.


Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/longlong.h


-- 


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


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

* [Bug target/41015] [4.4/4.5 Regression] SH: miscompilation for sh4-linux
  2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
                   ` (5 preceding siblings ...)
  2009-08-11 22:37 ` kkojima at gcc dot gnu dot org
@ 2009-08-11 22:38 ` kkojima at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-08-11 22:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kkojima at gcc dot gnu dot org  2009-08-11 22:38 -------
Fixed.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-08-11 22:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-09 16:26 [Bug target/41015] New: [4.4 Regression] SH: miscompilation for sh4-linux sugioka at itonet dot co dot jp
2009-08-09 16:28 ` [Bug target/41015] " sugioka at itonet dot co dot jp
2009-08-09 22:44 ` [Bug target/41015] [4.4/4.5 " kkojima at gcc dot gnu dot org
2009-08-10  4:47 ` sugioka at itonet dot co dot jp
2009-08-10  5:08 ` kkojima at gcc dot gnu dot org
2009-08-10 20:58 ` kkojima at gcc dot gnu dot org
2009-08-11 22:37 ` kkojima at gcc dot gnu dot org
2009-08-11 22:38 ` kkojima 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).