[llvm-bugs] [Bug 26300] New: [X86] Redundant zext when returning from i8 function

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 25 15:41:50 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26300

            Bug ID: 26300
           Summary: [X86] Redundant zext when returning from i8 function
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvm-bugs at lists.llvm.org
            Blocks: 26299
    Classification: Unclassified

For the following C++ code:

  bool f(int x, int y) {
    return x == y;
  }

clang -Os will generate:

00000000 <_Z1fii>:
   0:    8b 44 24 04              mov    0x4(%esp),%eax
   4:    3b 44 24 08              cmp    0x8(%esp),%eax
   8:    0f 94 c0                 sete   %al
   b:    0f b6 c0                 movzbl %al,%eax
   e:    c3                       ret.

The movzbl seems redundant, and neither GCC nor MSVC will generate it.

I suppose the motivation for clearing the high bits is breaking any potential
partial register dependency, but I don't think we should do that at -Os.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160125/c6f2133c/attachment.html>


More information about the llvm-bugs mailing list