Compiling the code in PR26944 with -O2 -march=pentium4 -fno-tree-ch
generates this for the loop:
.L3:
        movl    %esi, -4(%eax)
        addl    $1, %edx
        addl    $4, %eax
        cmpl    -16(%ebp), %edx  <----- note an extra memory access here
        jle     .L3

compiling for -march=i686 (or even just adding -fomit-frame-pointer) generates:

.L3:
        addl    $1, %ecx
        movl    %ebx, -4(%edx)
        addl    $4, %edx
        cmpl    %eax, %ecx  <---- no memory access here
        jle     .L3

The above problem does not happen with gcc-4.0.3 or 4.1.0


-- 
           Summary: [4.2 regression] worse code generated for -
                    march=pentium4
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to