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]

optimization/5263: Poor optimization for expression with more than three operands



>Number:         5263
>Category:       optimization
>Synopsis:       Poor optimization for expression with more than three operands
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 03 03:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     KT
>Release:        gcc-3.0.3
>Organization:
>Environment:
cygwin-intel-i686
>Description:
I noticed, that simple code like:
int f(int a,int b) { return a&b~a&~b; }
will converted to´something like that:

        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    12(%ebp), %ec
        popl    %ebp
        movl    %edx, %eax
        notl    %edx
        andl    %ecx, %eax
        notl    %ecx
        andl    %edx, %eax
        andl    %ecx, %eax
        ret

But the result should be something like:

        pushl   %ebp
        movl    %esp, %ebp
        xorl    %eax, %eax
        popl    %ebp
        ret

>How-To-Repeat:
Just let gcc with any optimization option tranlate some code like this:
int f(int a,int b)
{
 return a&b&~a&~b;
}
>Fix:
Maybe it could be used, in simplify-rtx.c, the same method like for PLUS and MINUS for IOR, AND and XOR ?
>Release-Note:
>Audit-Trail:
>Unformatted:


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