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

           Summary: Unnecessary testl
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


given

double foobar(double x, int y) {
  unsigned n = y;
  double p = 1;
  while (true) {
    n >>= 1;
    if (n == 0)
      return p;
  }
}

gcc produces:

__Z6foobardi:
shrl    %edi
jne    __Z6foobardi
movsd    0x00000004(%rip),%xmm0
re

clang produces:

__Z6foobardi:
shrl    %edi
testl    %edi,%edi
jne    __Z6foobardi
movsd    0x00000002(%rip),%xmm0
ret

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