mirror of
https://github.com/reactos/reactos.git
synced 2024-08-20 18:35:32 +00:00
merge from amd64 branch:
38333 [INTRIN_X86] #define _alloca() to __builtin_alloca() on amd64 46388 [INTRIN_X86] - Add __stosq, __movsq, _bittest64 svn path=/trunk/; revision=46599
This commit is contained in:
parent
018a23596b
commit
5ee8d1be0d
|
@ -74,6 +74,10 @@ extern "C" {
|
||||||
#define _AddressOfReturnAddress() (&(((void **)(__builtin_frame_address(0)))[1]))
|
#define _AddressOfReturnAddress() (&(((void **)(__builtin_frame_address(0)))[1]))
|
||||||
/* TODO: __getcallerseflags but how??? */
|
/* TODO: __getcallerseflags but how??? */
|
||||||
|
|
||||||
|
/* Maybe the same for x86? */
|
||||||
|
#ifdef _x86_64
|
||||||
|
#define _alloca(s) __builtin_alloca(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** Atomic operations ***/
|
/*** Atomic operations ***/
|
||||||
|
|
||||||
|
@ -565,6 +569,18 @@ __INTRIN_INLINE void __stosd(unsigned long * Dest, const unsigned long Data, siz
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
__INTRIN_INLINE void __stosq(unsigned __int64 * Dest, const unsigned __int64 Data, size_t Count)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__
|
||||||
|
(
|
||||||
|
"rep; stosq" :
|
||||||
|
[Dest] "=D" (Dest), [Count] "=c" (Count) :
|
||||||
|
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
__INTRIN_INLINE void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count)
|
__INTRIN_INLINE void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
|
@ -595,6 +611,18 @@ __INTRIN_INLINE void __movsd(unsigned long * Destination, const unsigned long *
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
__INTRIN_INLINE void __movsq(unsigned long * Destination, const unsigned long * Source, size_t Count)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__
|
||||||
|
(
|
||||||
|
"rep; movsq" :
|
||||||
|
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
|
||||||
|
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_M_AMD64)
|
#if defined(_M_AMD64)
|
||||||
/*** GS segment addressing ***/
|
/*** GS segment addressing ***/
|
||||||
|
|
||||||
|
@ -787,6 +815,20 @@ __INTRIN_INLINE unsigned char _bittest(const long * const a, const long b)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
__INTRIN_INLINE unsigned char _bittest64(const __int64 * const a, const __int64 b)
|
||||||
|
{
|
||||||
|
unsigned char retval;
|
||||||
|
|
||||||
|
if(__builtin_constant_p(b))
|
||||||
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 64))), [b] "Ir" (b % 64));
|
||||||
|
else
|
||||||
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*a), [b] "r" (b));
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
__INTRIN_INLINE unsigned char _bittestandcomplement(long * const a, const long b)
|
__INTRIN_INLINE unsigned char _bittestandcomplement(long * const a, const long b)
|
||||||
{
|
{
|
||||||
unsigned char retval;
|
unsigned char retval;
|
||||||
|
|
Loading…
Reference in a new issue