llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-x86 Author: Jannik Voss (vossjannik) <details> <summary>Changes</summary> The `_Interlocked*` and `_x*etbv` intrinsics are defined using the Microsoft-specific type __int64. __int64 is defined as long long across all platforms. However, in the builtin function database BuiltinsX86.td the intrinsics are defined using uint64_t. The type uint64_t can be either long or long long, depending on the target platform. This leads to incorrect definitions on platforms where uint64_t is not equivalent to long long. This PR aligns the type definitions in BuiltinsX86.td with the function signatures in xsaveintrin.h and immintrin.h. Following the precedent of functions like __emul(), we use the microsoft-specific unsigned __int64 definition in the header and use the resolved type 'unsigned long long int' in the builtin function database. --- Full diff: https://github.com/llvm/llvm-project/pull/154946.diff 1 Files Affected: - (modified) clang/include/clang/Basic/BuiltinsX86.td (+10-10) ``````````diff diff --git a/clang/include/clang/Basic/BuiltinsX86.td b/clang/include/clang/Basic/BuiltinsX86.td index 67cbbfdec7aaf6..ad8831ca13092c 100644 --- a/clang/include/clang/Basic/BuiltinsX86.td +++ b/clang/include/clang/Basic/BuiltinsX86.td @@ -768,7 +768,7 @@ let Features = "xsave", Attributes = [NoThrow] in { } let Header = "immintrin.h", Languages = "ALL_MS_LANGUAGES", Attributes = [NoThrow, RequireDeclaration] in { - def _xgetbv : X86LibBuiltin<"uint64_t(unsigned int)">; + def _xgetbv : X86LibBuiltin<"unsigned long long int(unsigned int)">; } let Features = "xsave", Attributes = [NoThrow] in { @@ -776,7 +776,7 @@ let Features = "xsave", Attributes = [NoThrow] in { } let Header = "immintrin.h", Languages = "ALL_MS_LANGUAGES", Attributes = [NoThrow, RequireDeclaration] in { - def _xsetbv : X86LibBuiltin<"void(unsigned int, uint64_t)">; + def _xsetbv : X86LibBuiltin<"void(unsigned int, unsigned long long int)">; } let Features = "xsaveopt", Attributes = [NoThrow] in { @@ -4769,14 +4769,14 @@ let Features = "sha512", Attributes = [NoThrow, RequiredVectorWidth<256>] in { } let Header = "intrin.h", Languages = "ALL_MS_LANGUAGES", Attributes = [NoThrow, RequireDeclaration] in { - def _InterlockedAnd64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; - def _InterlockedDecrement64 : X86LibBuiltin<"int64_t(int64_t volatile *)">; - def _InterlockedExchange64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; - def _InterlockedExchangeAdd64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; - def _InterlockedExchangeSub64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; - def _InterlockedIncrement64 : X86LibBuiltin<"int64_t(int64_t volatile *)">; - def _InterlockedOr64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; - def _InterlockedXor64 : X86LibBuiltin<"int64_t(int64_t volatile *, int64_t)">; + def _InterlockedAnd64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; + def _InterlockedDecrement64 : X86LibBuiltin<"long long int(long long int volatile *)">; + def _InterlockedExchange64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; + def _InterlockedExchangeAdd64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; + def _InterlockedExchangeSub64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; + def _InterlockedIncrement64 : X86LibBuiltin<"long long int(long long int volatile *)">; + def _InterlockedOr64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; + def _InterlockedXor64 : X86LibBuiltin<"long long int(long long int volatile *, long long int)">; } let Features = "sm3", Attributes = [NoThrow, RequiredVectorWidth<128>] in { `````````` </details> https://github.com/llvm/llvm-project/pull/154946 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits