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 rtl-optimization/34522] New: bad code for long long multiply when only low bits are needed


For

int test(long long a, long long b)
{
        return a * b;
}

GCC generates a widening multiply, and cannot remove the DImode operations
until after register allocation.  This causes unnecessary splits.

This could be fixed on the tree level by folding to (int)a * (int)b, or
alternatively in expand.

expand_expr is called with

 <mult_expr 0x2aaaae9032c0
    type <integer_type 0x2aaaae937840 long long int DI>
    arg 0 <parm_decl 0x2aaaae92d2d0 b type <integer_type 0x2aaaae937840 long
long int>>
    arg 1 <parm_decl 0x2aaaae92d240 a type <integer_type 0x2aaaae937840 long
long int>>>

and tmode SImode, still enough info to choose a better multiply.  However,
tmode is not passed on to expand_mult.


-- 
           Summary: bad code for long long multiply when only low bits are
                    needed
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gnu dot org


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


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