------- Comment #9 from rask at gcc dot gnu dot org  2007-11-28 18:01 -------
Created an attachment (id=14657)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14657&action=view)
Patch v2 to enhance cse.c

This patch also handles unsigned comparisons and thus optimizes the original
testcase too. Before:

foo:
        movl    4(%esp), %edx   # 2     *movsi_1/1      [length = 4]
        movl    8(%esp), %eax   # 3     *movsi_1/1      [length = 4]
        movl    %edx, %ecx      # 35    *movsi_1/1      [length = 2]
        subl    %eax, %ecx      # 7     *subsi_1/1      [length = 2]
        cmpl    %eax, %edx      # 8     *cmpsi_1_insn/1 [length = 2]
        jae     .L2             # 9     *jcc_1          [length = 2]
        addl    $100, %ecx      # 11    *addsi_1/1      [length = 3]
.L2:
        movl    %ecx, %eax      # 18    *movsi_1/1      [length = 2]
        ret                     # 38    return_internal [length = 1]

After:
foo:
        movl    4(%esp), %eax   # 2     *movsi_1/1      [length = 4]
        subl    8(%esp), %eax   # 8     *subsi3_cc_overflow/2   [length = 4]
        jae     .L2             # 9     *jcc_1          [length = 2]
        addl    $100, %eax      # 11    *addsi_1/1      [length = 3]
.L2:
        rep                     # 39    return_internal_long    [length = 1]
        ret

I was going to abandon this patch, but maybe it deserves a second chance. :-)


-- 

rask at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14647|0                           |1
        is obsolete|                            |


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

Reply via email to