http://llvm.org/bugs/show_bug.cgi?id=4548

           Summary: missed optimization: zext 8/16->32+udiv 32+trunc 32-
                    >8/16 -> udiv 8/16
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


For the C code below:

uint8_t udiv_i8(uint8_t a, uint8_t b)
{
  return a / b;
}

Clang generates this IR (at -O1/O2):

        %conv = zext i8 %a to i32       
        %conv2 = zext i8 %b to i32      
        %div = udiv i32 %conv, %conv2   
        %conv3 = trunc i32 %div to i8   
        ret i8 %conv3

This should be optimized to this IR, since that  is what the original C code
meant:

%div = udiv i8 %a, %b
ret i8 %div


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to