This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/23451] [3.4/4.0/4.1/4.2 regression] Redundant reloading from stack frame



------- Comment #5 from steven at gcc dot gnu dot org  2006-01-10 21:27 -------
FWIW, the peephole that we trigger is this one, which has been around since
forever (since rth's ia32 backend rewrite from the previous century...):

;; Don't compare memory with zero, load and use a test instead.
(define_peephole2
  [(set (match_operand 0 "flags_reg_operand" "")
        (match_operator 1 "compare_operator"
          [(match_operand:SI 2 "memory_operand" "")
           (const_int 0)]))
   (match_scratch:SI 3 "r")]
  "ix86_match_ccmode (insn, CCNOmode) && ! optimize_size"
  [(set (match_dup 3) (match_dup 2))
   (set (match_dup 0) (match_op_dup 1 [(match_dup 3) (const_int 0)]))]
  "")


But it feels like someone made a bad joke, or something.  These are some pieces
of what GCC 3.2 makes of it (with -march=i[456]86):

        movl    -16(%ebp), %eax
        xorl    %edi, %edi
        testl   %eax, %eax
        je      .L7
        subl    $12, %esp
        movl    -16(%ebp), %eax
        pushl   %eax
        call    strlen

and

        movl    -16(%ebp), %esi
        addl    $16, %esp
        testl   %esi, %esi
        je      .L6
        movb    $61, (%eax)
        pushl   %ecx
        pushl   %edi
        movl    -16(%ebp), %edx

This is on AMD64 -m32 with "GNU C version 3.2.3 (x86_64-unknown-linux-gnu)",   
    compiled by gcc 3.3-hammer-branch, gcc 3.4 and later can't compile gcc 3.2.


-- 


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]