[llvm-bugs] [Bug 49040] New: ms: _byteswap_ulong etc intrinsic generate calls

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 4 11:49:33 PST 2021


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

            Bug ID: 49040
           Summary: ms: _byteswap_ulong etc intrinsic generate calls
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Headers
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

$ 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 at Z":                    # @"?ByteSwap@@YAHI at Z"
# %bb.0:                                # %entry
        jmp     _byteswap_ulong                 # TAILCALL
                                        # -- End function



Compare to https://godbolt.org/z/97YjTT 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?

-- 
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/20210204/b521ff0d/attachment.html>


More information about the llvm-bugs mailing list