public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
@ 2011-06-23 11:20 ubizjak at gmail dot com
  2011-06-23 11:56 ` [Bug target/49515] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2011-06-23 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2
                    -fpic  execution test failure
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ubizjak@gmail.com
                CC: rth@gcc.gnu.org
            Target: alpha-linux-gnu


gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic testcase fails on
alphaev68-pc-linux-gnu due to clobbering of $16 register.

The problematic function in the testcase compiles to (-O2 -fpic):

$test_code..ng:
    ldq $27,__tls_get_addr($29)        !literal!1
    lda $30,-16($30)
    stq $26,0($30)
    stq $9,8($30)
    .prologue 1
    mov $16,$9
    lda $16,fstat($29)        !tlsldm!1
    jsr $26,($27),__tls_get_addr        !lituse_tlsldm!1
    ldah $29,0($26)        !gpdisp!3
    ldah $1,fstat($0)        !dtprelhi
    ldq $26,0($30)
    lda $29,0($29)        !gpdisp!3
>>>	ldl $16,fstat($1)		!dtprello
>>>	addl $16,$9,$16
    ldq $9,8($30)
    addl $31,$16,$0
>>>	stl $16,fstat($1)		!dtprello
    lda $30,16($30)
    ret $31,($26),1

$ ./a.out
a=2 fstat=33554434
Aborted

The difference to working code from gcc-4.4.5 is:

@@ -26,17 +26,18 @@
     ldah $1,fstat($0)        !dtprelhi
     ldq $26,0($30)
     lda $29,0($29)        !gpdisp!3
-    ldl $0,fstat($1)        !dtprello
-    addl $0,$9,$0
+    ldl $16,fstat($1)        !dtprello
+    addl $16,$9,$16
     ldq $9,8($30)
-    stl $0,fstat($1)        !dtprello
+    addl $31,$16,$0
+    stl $16,fstat($1)        !dtprello
     lda $30,16($30)
     ret $31,($26),1

Please note that $0 is used instead (extra addl is just a move from $16 to $0).

Does !dtprello relocation need live $16 register? The relevant patterns in
alpha.md do not model that dependancy.


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

* [Bug target/49515] [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
  2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
@ 2011-06-23 11:56 ` rguenth at gcc dot gnu.org
  2011-06-23 15:39 ` rth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-23 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug target/49515] [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
  2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
  2011-06-23 11:56 ` [Bug target/49515] " rguenth at gcc dot gnu.org
@ 2011-06-23 15:39 ` rth at gcc dot gnu.org
  2011-06-24  7:42 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rth at gcc dot gnu.org @ 2011-06-23 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Henderson <rth at gcc dot gnu.org> 2011-06-23 15:39:19 UTC ---
(In reply to comment #0)
> Does !dtprello relocation need live $16 register? The relevant patterns in
> alpha.md do not model that dependancy.

No, DTPREL relocations are constants.  They are the offset to be added
to a TLSLDM base value.  You can see that happening both in the old and
new code sequences.

The code difference you show cannot be the real problem.  The register
allocator has made a poorer choice in 4.7, leading to an extra move,
but the code that you show is exactly equivalent.

Is linker relaxation messing with this code sequence, perhaps?


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

* [Bug target/49515] [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
  2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
  2011-06-23 11:56 ` [Bug target/49515] " rguenth at gcc dot gnu.org
  2011-06-23 15:39 ` rth at gcc dot gnu.org
@ 2011-06-24  7:42 ` ubizjak at gmail dot com
  2011-06-24  7:56 ` ubizjak at gmail dot com
  2011-06-24 10:02 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2011-06-24  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2011-06-24 07:42:20 UTC ---
(In reply to comment #1)

> Is linker relaxation messing with this code sequence, perhaps?

You are correct. Adding -Wl,--no-relax produces correct binary.

I will open a binutils bugreport and recycle this one as a RA problem due to
extra register move.


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

* [Bug target/49515] [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
  2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
                   ` (2 preceding siblings ...)
  2011-06-24  7:42 ` ubizjak at gmail dot com
@ 2011-06-24  7:56 ` ubizjak at gmail dot com
  2011-06-24 10:02 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2011-06-24  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

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

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2011-06-24 07:56:16 UTC ---
(In reply to comment #2)

> I will open a binutils bugreport...

Binutils PR 12928 [1].

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=12928


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

* [Bug target/49515] [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c  -O2  -fpic  execution test failure
  2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
                   ` (3 preceding siblings ...)
  2011-06-24  7:56 ` ubizjak at gmail dot com
@ 2011-06-24 10:02 ` ubizjak at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: ubizjak at gmail dot com @ 2011-06-24 10:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2011-06-24 10:01:28 UTC ---
(In reply to comment #1)

> The code difference you show cannot be the real problem.  The register
> allocator has made a poorer choice in 4.7, leading to an extra move,
> but the code that you show is exactly equivalent.

The move is actually a sign extension instruction, so 4.7 code looks more
correct to me.


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

end of thread, other threads:[~2011-06-24 10:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23 11:20 [Bug target/49515] New: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure ubizjak at gmail dot com
2011-06-23 11:56 ` [Bug target/49515] " rguenth at gcc dot gnu.org
2011-06-23 15:39 ` rth at gcc dot gnu.org
2011-06-24  7:42 ` ubizjak at gmail dot com
2011-06-24  7:56 ` ubizjak at gmail dot com
2011-06-24 10:02 ` ubizjak at gmail dot com

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).