<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] Failing to tail call with bool parameter"
   href="https://llvm.org/bugs/show_bug.cgi?id=26305">26305</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] Failing to tail call with bool parameter
          </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>Consider:

  void f(bool);
  void g(bool x) {
    f(x);
  }

Clang will generate:

00000000 <_Z1gb>:
   0:    83 ec 0c                 sub    $0xc,%esp
   3:    0f b6 44 24 10           movzbl 0x10(%esp),%eax
   8:    89 04 24                 mov    %eax,(%esp)
   b:    e8 fc ff ff ff           call   c <_Z1gb+0xc>
  10:    83 c4 0c                 add    $0xc,%esp
  13:    c3                       ret


GCC 5.3 will do the tail call, but still insists on zexting:

g(bool):
        movzbl  4(%esp), %eax
        movl    %eax, 4(%esp)
        jmp     f(bool)

MSVC hits the spot and emits a single jmp:

?g@@YAX_N@Z (void __cdecl g(bool)):
  00000000: E9 00 00 00 00     jmp         ?f@@YAX_N@Z</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>