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

             Bug #: 11567
           Summary: unnecessary sign extension
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


in
-------------------------------------------
extern void do_something_with(char *arr);

void foo(char **arr, int n) {
   for (T i = 0; i < n; i++) {
     do_something_with(arr[2*i]);
   }
}
------------------------------------------

the loop produced by clang is

movslq %r15d,%r15
mov    (%r14,%r15,8),%rdi
callq  1d <foo+0x1d>
add    $0x2,%r15d
dec    %ebx
jne    11 <foo+0x11>

the loop produced by gcc is

mov    0x0(%rbp),%rdi
inc    %ebx
add    $0x10,%rbp
callq  1d <foo+0x1d>
cmp    %r12d,%ebx
jl     e <foo+0xe>

-- 
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