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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

$ 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 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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to