1818#include <intrin0.h>
1919
2020/* First include the standard intrinsics. */
21- #if defined(__i386__ ) || defined(__x86_64__ )
21+ #if defined(__i386__ ) || ( defined(__x86_64__ ) && !defined( __arm64ec__ ) )
2222#include <x86intrin.h>
2323#endif
2424
@@ -166,7 +166,7 @@ unsigned __int32 xbegin(void);
166166void _xend (void );
167167
168168/* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */
169- #ifdef __x86_64__
169+ #if defined( __x86_64__ ) && !defined( __arm64ec__ )
170170void __addgsbyte (unsigned long , unsigned char );
171171void __addgsdword (unsigned long , unsigned long );
172172void __addgsqword (unsigned long , unsigned __int64 );
@@ -236,7 +236,8 @@ __int64 _mul128(__int64, __int64, __int64 *);
236236/*----------------------------------------------------------------------------*\
237237|* movs, stos
238238\*----------------------------------------------------------------------------*/
239- #if defined(__i386__ ) || defined(__x86_64__ )
239+
240+ #if defined(__i386__ ) || (defined(__x86_64__ ) && !defined(__arm64ec__ ))
240241static __inline__ void __DEFAULT_FN_ATTRS __movsb (unsigned char * __dst ,
241242 unsigned char const * __src ,
242243 size_t __n ) {
@@ -305,7 +306,7 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosw(unsigned short *__dst,
305306 : "memory" );
306307}
307308#endif
308- #ifdef __x86_64__
309+ #if defined( __x86_64__ ) && !defined( __arm64ec__ )
309310static __inline__ void __DEFAULT_FN_ATTRS __movsq (
310311 unsigned long long * __dst , unsigned long long const * __src , size_t __n ) {
311312 __asm__ __volatile__("rep movsq"
@@ -324,7 +325,7 @@ static __inline__ void __DEFAULT_FN_ATTRS __stosq(unsigned __int64 *__dst,
324325/*----------------------------------------------------------------------------*\
325326|* Misc
326327\*----------------------------------------------------------------------------*/
327- #if defined(__i386__ ) || defined(__x86_64__ )
328+ #if defined(__i386__ ) || ( defined(__x86_64__ ) && !defined( __arm64ec__ ) )
328329static __inline__ void __DEFAULT_FN_ATTRS __halt (void ) {
329330 __asm__ volatile ("hlt" );
330331}
@@ -339,7 +340,7 @@ static __inline__ void __DEFAULT_FN_ATTRS __nop(void) {
339340/*----------------------------------------------------------------------------*\
340341|* MS AArch64 specific
341342\*----------------------------------------------------------------------------*/
342- #if defined(__aarch64__ )
343+ #if defined(__aarch64__ ) || defined( __arm64ec__ )
343344unsigned __int64 __getReg (int );
344345long _InterlockedAdd (long volatile * Addend , long Value );
345346__int64 _InterlockedAdd64 (__int64 volatile * Addend , __int64 Value );
@@ -383,7 +384,7 @@ void __cdecl __prefetch(void *);
383384/*----------------------------------------------------------------------------*\
384385|* Privileged intrinsics
385386\*----------------------------------------------------------------------------*/
386- #if defined(__i386__ ) || defined(__x86_64__ )
387+ #if defined(__i386__ ) || ( defined(__x86_64__ ) && !defined( __arm64ec__ ) )
387388static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
388389__readmsr (unsigned long __register ) {
389390 // Loads the contents of a 64-bit model specific register (MSR) specified in
@@ -397,7 +398,6 @@ __readmsr(unsigned long __register) {
397398 __asm__ ("rdmsr" : "=d" (__edx ), "=a" (__eax ) : "c" (__register ));
398399 return (((unsigned __int64 )__edx ) << 32 ) | (unsigned __int64 )__eax ;
399400}
400- #endif
401401
402402static __inline__ unsigned __LPTRINT_TYPE__ __DEFAULT_FN_ATTRS __readcr3 (void ) {
403403 unsigned __LPTRINT_TYPE__ __cr3_val ;
@@ -413,6 +413,7 @@ static __inline__ void __DEFAULT_FN_ATTRS
413413__writecr3 (unsigned __INTPTR_TYPE__ __cr3_val ) {
414414 __asm__ ("mov {%0, %%cr3|cr3, %0}" : : "r" (__cr3_val ) : "memory" );
415415}
416+ #endif
416417
417418#ifdef __cplusplus
418419}
0 commit comments