<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [X86] Redundant zext when returning from i8 function"
   href="https://llvm.org/bugs/show_bug.cgi?id=26300">26300</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] Redundant zext when returning from i8 function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>26299
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>