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

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