public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop
@ 2010-10-27 16:57 miles at gnu dot org
  2010-10-28 14:53 ` [Bug target/46200] [4.6 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: miles at gnu dot org @ 2010-10-27 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: optimization regression in simple pointer loop
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: miles@gnu.org


I compiled this simple test function with both g++ 4.5.1 and g++-4.6
(2010-10-16 snapshot):

  void test (int *b, int *e, int stride)
  {
    for (int *p = b; p != e; p += stride)
      *p = 1;
  }

Using compiler options "-O2 -march=core2 -S".

I got the following asm output;

g++ 4.5.1:

  .globl test(int*, int*, int)
  test(int*, int*, int):
          cmpq    %rsi, %rdi
          je      .L1
          movslq  %edx, %rax
          salq    $2, %rax
  .L3:
          movl    $1, (%rdi)
          addq    %rax, %rdi
          cmpq    %rdi, %rsi
          jne     .L3
  .L1:
          rep
          ret


g++-4.6 (2010-10-16 snapshot):

  test(int*, int*, int):
          cmpq    %rsi, %rdi
          je      .L1
          movslq  %edx, %rdx
          salq    $2, %rdx
          movq    %rdx, %rcx
          addq    %rdx, %rdi
          negq    %rcx
          jmp     .L3
  .L4:
          movq    %rax, %rdi
  .L3:
          movl    $1, (%rdi,%rcx)
          leaq    (%rdi,%rdx), %rax
          cmpq    %rdi, %rsi
          jne     .L4
  .L1:
          rep
          ret


The output of 4.6 seems clearly worse than the output of 4.5.

Thanks,

-miles


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
@ 2010-10-28 14:53 ` rguenth at gcc dot gnu.org
  2010-10-28 17:14 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-28 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.28 14:53:08
          Component|rtl-optimization            |target
   Target Milestone|---                         |4.6.0
            Summary|optimization regression in  |[4.6 Regression]
                   |simple pointer loop         |optimization regression in
                   |                            |simple pointer loop
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-28 14:53:08 UTC ---
Confirmed.


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
  2010-10-28 14:53 ` [Bug target/46200] [4.6 Regression] " rguenth at gcc dot gnu.org
@ 2010-10-28 17:14 ` hjl.tools at gmail dot com
  2010-10-28 17:43 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2010-10-28 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |mkuvyrkov at gmail dot com

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2010-10-28 17:14:28 UTC ---
Does -mtune=generic have regressions? The current -mtune=core2 is slower
than -mtune=generic.

Maxim, could you please try this tescase with your Core 2/Core i7 changes?


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
  2010-10-28 14:53 ` [Bug target/46200] [4.6 Regression] " rguenth at gcc dot gnu.org
  2010-10-28 17:14 ` hjl.tools at gmail dot com
@ 2010-10-28 17:43 ` pinskia at gcc dot gnu.org
  2010-10-28 17:54 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-10-28 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-10-28 17:42:55 UTC ---
I saw this with generic tuning also.


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
                   ` (2 preceding siblings ...)
  2010-10-28 17:43 ` pinskia at gcc dot gnu.org
@ 2010-10-28 17:54 ` hjl.tools at gmail dot com
  2010-10-28 19:01 ` davidxl at gcc dot gnu.org
  2010-11-03 22:41 ` davidxl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2010-10-28 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xinliangli at gmail dot com

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2010-10-28 17:53:50 UTC ---
It is caused by revision 162653:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg01007.html

With -o2, revision 162651 gave:

test:
.LFB0:
    .cfi_startproc
    cmpq    %rsi, %rdi
    je    .L1
    movslq    %edx, %rdx
    salq    $2, %rdx
    .p2align 4,,10
    .p2align 3
.L3:
    movl    $1, (%rdi)
    addq    %rdx, %rdi
    cmpq    %rdi, %rsi
    jne    .L3
.L1:
    rep
    ret
    .cfi_endproc

Revision 162653 gave

test:
.LFB0:
    .cfi_startproc
    cmpq    %rsi, %rdi
    je    .L1
    movslq    %edx, %rdx
    salq    $2, %rdx
    movq    %rdx, %rcx
    addq    %rdx, %rdi
    negq    %rcx
    .p2align 4,,10
    .p2align 3
.L3:
    movl    $1, (%rdi,%rcx)
    addq    %rdx, %rdi
    movq    %rdi, %rax
    subq    %rdx, %rax
    cmpq    %rax, %rsi
    jne    .L3
.L1:
    rep
    ret


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
                   ` (3 preceding siblings ...)
  2010-10-28 17:54 ` hjl.tools at gmail dot com
@ 2010-10-28 19:01 ` davidxl at gcc dot gnu.org
  2010-11-03 22:41 ` davidxl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: davidxl at gcc dot gnu.org @ 2010-10-28 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

davidxl <davidxl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |davidxl at gcc dot gnu.org

--- Comment #5 from davidxl <davidxl at gcc dot gnu.org> 2010-10-28 19:01:16 UTC ---
Confirmed.

The problem seems to be in the cost computation for loop exit tests -- the cost
associated with iv update seem to be double counted (already considered as iv
cost, but included again in testing cost). If this is the root cause, it is
there since day-1, but exposed by the ivopt enhancement patch.

David


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

* [Bug target/46200] [4.6 Regression] optimization regression in simple pointer loop
  2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
                   ` (4 preceding siblings ...)
  2010-10-28 19:01 ` davidxl at gcc dot gnu.org
@ 2010-11-03 22:41 ` davidxl at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: davidxl at gcc dot gnu.org @ 2010-11-03 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

davidxl <davidxl at gcc dot gnu.org> changed:

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

--- Comment #6 from davidxl <davidxl at gcc dot gnu.org> 2010-11-03 22:40:56 UTC ---
Fix in r166280.


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

end of thread, other threads:[~2010-11-03 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 16:57 [Bug rtl-optimization/46200] New: optimization regression in simple pointer loop miles at gnu dot org
2010-10-28 14:53 ` [Bug target/46200] [4.6 Regression] " rguenth at gcc dot gnu.org
2010-10-28 17:14 ` hjl.tools at gmail dot com
2010-10-28 17:43 ` pinskia at gcc dot gnu.org
2010-10-28 17:54 ` hjl.tools at gmail dot com
2010-10-28 19:01 ` davidxl at gcc dot gnu.org
2010-11-03 22:41 ` davidxl at gcc dot gnu.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).