<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ms: _byteswap_ulong etc intrinsic generate calls"
   href="https://bugs.llvm.org/show_bug.cgi?id=49040">49040</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ms: _byteswap_ulong etc intrinsic generate calls
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Headers
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat bswap.cc 
#include <stdint.h>
#include <intrin.h>

int32_t ByteSwap(uint32_t x) {
  return _byteswap_ulong(x);
}

$ out/gn/bin/clang-cl /FA /c bswap.cc /O2 /winsysroot
~/src/chrome/src/third_party/depot_tools/win_toolchain/vs_files/782813b4eb/
$ cat bswap.asm
...
"?ByteSwap@@YAHI@Z":                    # @"?ByteSwap@@YAHI@Z"
# %bb.0:                                # %entry
        jmp     _byteswap_ulong                 # TAILCALL
                                        # -- End function



Compare to <a href="https://godbolt.org/z/97YjTT">https://godbolt.org/z/97YjTT</a> in MSVC.



Our clang/lib/Headers/intrin.h only has a declaration for these functions in
arm64 mode for some reason. So how does this even build? => Windows
Kits/10/Include/10.0.19041.0/ucrt/stdlib.h declares these too.

So I guess we should put these in intrin.h, with an inline definition?</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>