I just tried out a CVS copy of gcc and found problems with the following code:

long foo()
{
        long int word;
        word += 2147483647UL;
        return word;
}

When compiled as 64bit uses the __adddi3 helper function:

        mflr 0
        li 4,-1
        rldicl 4,4,0,33
        std 0,16(1)
        stdu 1,-112(1)
        bl __adddi3
        nop
        addi 1,1,112
        ld 0,16(1)
        mtlr 0
        blr

gcc 3.4.4 did a much better job:

        li 3,-1
        rldicl 3,3,0,33
        add 3,0,3
        blr

-- 
           Summary: 64bit target uses __adddi3
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-unknown-linux-gnu


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

Reply via email to