]> granicus.if.org Git - clang/commitdiff
[COFF, ARM64] Remove definitions for _byteswap library functions
authorTom Tan <Tom.Tan@microsoft.com>
Mon, 11 Feb 2019 20:04:02 +0000 (20:04 +0000)
committerTom Tan <Tom.Tan@microsoft.com>
Mon, 11 Feb 2019 20:04:02 +0000 (20:04 +0000)
_byteswap_* functions are are implemented in below file as normal function
from libucrt.lib and declared in stdlib.h. Define them in intrin.h triggers
lld error "conflicting comdat type" and "duplicate symbols" which was just
added to LLD (https://reviews.llvm.org/D57324).

C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt\stdlib\byteswap.cpp

Differential Revision: https://reviews.llvm.org/D57915

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353740 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/intrin.h
test/Headers/ms-arm64-intrin.cpp

index 6cc6155aa603dacbe075c8fbaae4237818579930..e7508a4c15e9431771d826a6e7ac797f656f7ede 100644 (file)
@@ -557,15 +557,9 @@ long _InterlockedAdd(long volatile *Addend, long Value);
 __int64 _ReadStatusReg(int);
 void _WriteStatusReg(int, __int64);
 
-static inline unsigned short _byteswap_ushort (unsigned short val) {
-  return __builtin_bswap16(val);
-}
-static inline unsigned long _byteswap_ulong (unsigned long val) {
-  return __builtin_bswap32(val);
-}
-static inline unsigned __int64 _byteswap_uint64 (unsigned __int64 val) {
-  return __builtin_bswap64(val);
-}
+unsigned short __cdecl _byteswap_ushort(unsigned short val);
+unsigned long __cdecl _byteswap_ulong (unsigned long val);
+unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 val);
 #endif
 
 /*----------------------------------------------------------------------------*\
index 729ca5e7f2d248c656e11a4ea3d2170d04d60110..2e052b33bf8ec219f8d06be754864fdf3643f369 100644 (file)
@@ -14,16 +14,16 @@ void check_nop() {
 }
 
 unsigned short check_byteswap_ushort(unsigned short val) {
-// CHECK: call i16 @llvm.bswap.i16(i16 %val)
+// CHECK: call i16 @_byteswap_ushort(i16 %val)
   return _byteswap_ushort(val);
 }
 
 unsigned long check_byteswap_ulong(unsigned long val) {
-// CHECK: call i32 @llvm.bswap.i32(i32 %val)
+// CHECK: call i32 @_byteswap_ulong(i32 %val)
   return _byteswap_ulong(val);
 }
 
 unsigned __int64 check_byteswap_uint64(unsigned __int64 val) {
-// CHECK: call i64 @llvm.bswap.i64(i64 %val)
+// CHECK: call i64 @_byteswap_uint64(i64 %val)
   return _byteswap_uint64(val);
 }