Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Supersedes: 201370
AFAIU x86intrin.h is a GCC/Clang specific header, but I think __i386__ and __x86_64__ are too so we don't need _MSC_VER guard here? But the same seems to be true for __arm__ so I'm not sure why there's such guard around __dmb intrinsics below.
I'm not resending the previous patches (201367-201369,201372) because they should be quite independent, and would also make Marvin do a full build again. I'm interested to know if there's anything to fix on them.
Patch 201371 has some rounding errors that I will fix.
include/msvcrt/intrin.h | 4 ++++ include/msvcrt/stdlib.h | 8 ++++++++ tools/makedep.c | 1 + 3 files changed, 13 insertions(+)
diff --git a/include/msvcrt/intrin.h b/include/msvcrt/intrin.h index 781c6fac823..8b84929bc02 100644 --- a/include/msvcrt/intrin.h +++ b/include/msvcrt/intrin.h @@ -7,6 +7,10 @@ #ifndef _INC_INTRIN #define _INC_INTRIN
+#if defined(__i386__) || defined(__x86_64__) +# include <x86intrin.h> +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index ed6560bc318..287e4030669 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -164,15 +164,23 @@ _ACRTIMP char* __cdecl _itoa(int,char*,int); _ACRTIMP errno_t __cdecl _itoa_s(int,char*,size_t,int); _ACRTIMP char* __cdecl _ltoa(__msvcrt_long,char*,int); _ACRTIMP errno_t __cdecl _ltoa_s(__msvcrt_long, char*, size_t, int); +#ifndef _lrotl _ACRTIMP __msvcrt_ulong __cdecl _lrotl(__msvcrt_ulong,int); +#endif +#ifndef _lrotr _ACRTIMP __msvcrt_ulong __cdecl _lrotr(__msvcrt_ulong,int); +#endif _ACRTIMP void __cdecl _makepath(char*,const char*,const char*,const char*,const char*); _ACRTIMP int __cdecl _makepath_s(char*,size_t,const char*,const char*,const char*,const char*); _ACRTIMP size_t __cdecl _mbstrlen(const char*); _ACRTIMP _onexit_t __cdecl _onexit(_onexit_t); _ACRTIMP int __cdecl _putenv(const char*); +#ifndef _rotl _ACRTIMP unsigned int __cdecl _rotl(unsigned int,int); +#endif +#ifndef _rotr _ACRTIMP unsigned int __cdecl _rotr(unsigned int,int); +#endif _ACRTIMP void __cdecl _searchenv(const char*,const char*,char*); _ACRTIMP int __cdecl _set_error_mode(int); _ACRTIMP void __cdecl _seterrormode(int); diff --git a/tools/makedep.c b/tools/makedep.c index 913854c7f05..8245a324279 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1570,6 +1570,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_ if (pFile->type == INCL_SYSTEM && pFile->use_msvcrt) { if (!strcmp( pFile->name, "stdarg.h" )) return NULL; + if (!strcmp( pFile->name, "x86intrin.h" )) return NULL; fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", pFile->included_by->file->name, pFile->included_line, pFile->name ); exit(1);
Signed-off-by: Jacek Caban jacek@codeweavers.com
---
On 15.03.2021 16:07, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
Supersedes: 201370
AFAIU x86intrin.h is a GCC/Clang specific header, but I think __i386__ and __x86_64__ are too so we don't need _MSC_VER guard here? But the same seems to be true for __arm__ so I'm not sure why there's such guard around __dmb intrinsics below.
No, it's not GCC specific and I think that we actually want to use it on clang msvc target (like your patch does).
FWIW, if it was just for sake of __rdtsc and __rdtscp, I'd say that we could just use inline assembly. However, I think that having functional intrin.h is nice to have and this change will be useful in the future.
Thanks,
Jacek
On 3/16/21 5:36 PM, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
On 15.03.2021 16:07, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
Supersedes: 201370
AFAIU x86intrin.h is a GCC/Clang specific header, but I think __i386__ and __x86_64__ are too so we don't need _MSC_VER guard here? But the same seems to be true for __arm__ so I'm not sure why there's such guard around __dmb intrinsics below.
No, it's not GCC specific and I think that we actually want to use it on clang msvc target (like your patch does).
Ah yes, but what I meant was that MSVC doesn't have it. Is clang msvc target defining _MSC_VER too?
FWIW, if it was just for sake of __rdtsc and __rdtscp, I'd say that we could just use inline assembly. However, I think that having functional intrin.h is nice to have and this change will be useful in the future.
Thanks,
Jacek
Rémi Bernon rbernon@codeweavers.com
On 16.03.2021 17:40, Rémi Bernon wrote:
On 3/16/21 5:36 PM, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
On 15.03.2021 16:07, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
Supersedes: 201370
AFAIU x86intrin.h is a GCC/Clang specific header, but I think __i386__ and __x86_64__ are too so we don't need _MSC_VER guard here? But the same seems to be true for __arm__ so I'm not sure why there's such guard around __dmb intrinsics below.
No, it's not GCC specific and I think that we actually want to use it on clang msvc target (like your patch does).
Ah yes, but what I meant was that MSVC doesn't have it. Is clang msvc target defining _MSC_VER too?
Yes, it defines _MSC_VER. Also see:
https://source.winehq.org/git/wine.git/blob/HEAD:/configure.ac#l2734
Jacek