in function cryptcompress_truncate() from reiserfs4 patch  
compiler uses __cmpdi2 for old_size vs new_size (64 bit) comparision:  
  
 result = (old_size < new_size ? cryptcompress_append_hole(inode, new_size) :  
    prune_cryptcompress(inode, new_size, update_sd, aidx));  
  
in another case for simple foo() method gcc inlines __cmpdi2 equivalent:  
  
int foo(long long x, long long y) { return (x < y); }  
  
foo:    cmpw 7,5,3  
        li 0,0  
        bgt- 7,.L3  
        cmplw 6,6,4  
        beq- 7,.L6  
.L2:    mr 3,0  
        blr  
.L6:    ble- 6,.L2  
.L3:    li 0,1  
        mr 3,0  
        blr  
  
what decides which variant is chosen? 
is it possible to force inlining? 
 
# gcc-4.0.0+pr20973+pr21173

-- 
           Summary: unnecessary __cmpdi2 usage?
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at pld-linux dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pld-linux
  GCC host triplet: i686-pld-linux
GCC target triplet: ppc-pld-linux


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

Reply via email to