__movsb, __movsd, __movsq, __movsw: Move these intrinsics from library-only to intrin-impl.

dw
Index: mingw-w64-crt/intrincs/__movsb.c
===================================================================
--- mingw-w64-crt/intrincs/__movsb.c	(revision 6265)
+++ mingw-w64-crt/intrincs/__movsb.c	(working copy)
@@ -1,12 +1,10 @@
-#include <intrin.h>
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
 
-void __movsb(unsigned char *Destination, unsigned char const *Source, size_t Count)
-{
-  __asm__ __volatile__
-  (
-    "rep; movsb" :
-    [Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
-    "[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
-  );
-}
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___movsb /* Causes code generation in intrin-impl.h */
 
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/__movsd.c
===================================================================
--- mingw-w64-crt/intrincs/__movsd.c	(revision 6265)
+++ mingw-w64-crt/intrincs/__movsd.c	(working copy)
@@ -1,12 +1,10 @@
-#include <intrin.h>
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
 
-void __movsd(unsigned __LONG32 *Dest, unsigned __LONG32 const *Source, size_t Count)
-{
-  __asm__ __volatile__
-  (
-    "rep; movsd" :
-    [Dest] "=D" (Dest), [Source] "=S" (Source), [Count] "=c" (Count) :
-    "[Dest]" (Dest), "[Source]" (Source), "[Count]" (Count)
-  );
-}
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___movsd /* Causes code generation in intrin-impl.h */
 
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/__movsq.c
===================================================================
--- mingw-w64-crt/intrincs/__movsq.c	(revision 6265)
+++ mingw-w64-crt/intrincs/__movsq.c	(working copy)
@@ -1,12 +1,10 @@
-#include <intrin.h>
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
 
-void __movsq(unsigned long long *Dest, unsigned long long const *Source, size_t Count)
-{
-  __asm__ __volatile__
-  (
-    "rep; movsq" :
-    [Dest] "=D" (Dest), [Source] "=S" (Source), [Count] "=c" (Count) :
-    "[Dest]" (Dest), "[Source]" (Source), "[Count]" (Count)
-  );
-}
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___movsq /* Causes code generation in intrin-impl.h */
 
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/__movsw.c
===================================================================
--- mingw-w64-crt/intrincs/__movsw.c	(revision 6265)
+++ mingw-w64-crt/intrincs/__movsw.c	(working copy)
@@ -1,12 +1,10 @@
-#include <intrin.h>
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
 
-void __movsw(unsigned short *Dest, unsigned short const *Source, size_t Count)
-{
-  __asm__ __volatile__
-  (
-    "rep; movsw" :
-    [Dest] "=D" (Dest), [Source] "=S" (Source), [Count] "=c" (Count) :
-    "[Dest]" (Dest), "[Source]" (Source), "[Count]" (Count)
-  );
-}
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL___movsw /* Causes code generation in intrin-impl.h */
 
+#include <intrin.h>
Index: mingw-w64-headers/crt/intrin.h
===================================================================
--- mingw-w64-headers/crt/intrin.h	(revision 6265)
+++ mingw-w64-headers/crt/intrin.h	(working copy)
@@ -20,13 +20,13 @@
      is included by intrin.h, as well as various platform sdk headers.
    - Including intrin.h will create definitions/implementations for all available MSVC intrinsics.
    - Including various platforms sdk headers will only include the intrinsics defined in that
-     header.  As of this writing, only winnt.h uses this approach.
+     header.  As of this writing, only winnt.h and winbase.h use this approach.
    - If an application defines its own prototypes for intrinsics (ie without including any
      platform header or intrin.h), the symbols will be resolved from the library.  Since this
      will likely result in the code being invoked via 'call', performance may be degraded.
 
    If you wish to implement intrinsic functions that are defined in intrin.h but are not
-   yet implemented in mingw, see the comments at the top of intrin-impl.h.
+   yet implemented in mingw-w64, see the comments at the top of intrin-impl.h.
 */
 
 #ifndef __INTRIN_H_
@@ -1020,10 +1020,10 @@
 #ifndef __GNUC__
     __MACHINEI(__MINGW_EXTENSION unsigned __int64 __rdtsc(void))
 #endif
-    __MACHINEI(void __movsb(unsigned char *,unsigned char const *,size_t))
-    __MACHINEI(void __movsw(unsigned short *,unsigned short const *,size_t))
-    __MACHINEI(void __movsd(unsigned __LONG32 *,unsigned __LONG32 const *,size_t))
-    __MACHINEX64(__MINGW_EXTENSION void __movsq(unsigned long long *,unsigned long long const *,size_t))
+    /* __MACHINEI(void __movsb(unsigned char *,unsigned char const *,size_t)) moved to psdk_inc/intrin-impl.h */
+    /* __MACHINEI(void __movsw(unsigned short *,unsigned short const *,size_t)) moved to psdk_inc/intrin-impl.h */
+    /* __MACHINEI(void __movsd(unsigned __LONG32 *,unsigned __LONG32 const *,size_t)) moved to psdk_inc/intrin-impl.h */
+    /* __MACHINEX64(__MINGW_EXTENSION void __movsq(unsigned long long *,unsigned long long const *,size_t)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEX64(unsigned char __readgsbyte(unsigned __LONG32 Offset)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEX64(unsigned short __readgsword(unsigned __LONG32 Offset)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEX64(unsigned __LONG32 __readgsdword(unsigned __LONG32 Offset)) moved to psdk_inc/intrin-impl.h */
Index: mingw-w64-headers/include/psdk_inc/intrin-impl.h
===================================================================
--- mingw-w64-headers/include/psdk_inc/intrin-impl.h	(revision 6265)
+++ mingw-w64-headers/include/psdk_inc/intrin-impl.h	(working copy)
@@ -70,13 +70,14 @@
 
 /* Parameters: (FunctionName, DataType, Operator)
    FunctionName: Any valid function name
-   DataType: BYTE, WORD, DWORD or DWORD64 */
+   DataType: BYTE, WORD, DWORD or DWORD64
+   InstructionSizeIntel: b, w, d, q (not b,w,l,q) */
 
 /* While we don't need the output values for Dest or Count, we
    must still inform the compiler the asm changes them. */
-#define __buildstos(x, y) void x(y *Dest, y Data, size_t Count) \
+#define __buildstos(x, y, z) void x(y *Dest, y Data, size_t Count) \
 { \
-   __asm__ __volatile__ ("rep stos%z[Data]" \
+   __asm__ __volatile__ ("rep stos{%z[Data]|" z "}" \
       : "+D" (Dest), "+c" (Count) \
       : [Data] "a" (Data) \
       : "memory"); \
@@ -305,6 +306,23 @@
        : "memory"); \
    }
 
+/* This macro is used by __movsb, __movsd, __movsq, __movsw
+
+Parameters: (FunctionName, DataType, RegisterNumber)
+   FunctionName: Any valid function name
+   DataType: unsigned char, unsigned short, unsigned __LONG32, unsigned __int64
+   InstructionSize: b, w, d, q
+
+   */
+#define __buildmov(x, y, z) void x(y *Destination, y const *Source, size_t Count) \
+{ \
+  __asm__ __volatile__ ( \
+    "rep movs" z \
+       : "=D" (Destination), "=S" (Source), "=c" (Count) \
+       : "0" (Destination), "1" (Source), "2" (Count) \
+       : "memory"); \
+}
+
 #endif /* _INTRIN_MAC_ */
 
 /* The Barrier functions can never be in the library.  Since gcc only
@@ -422,6 +440,10 @@
 #define __INTRINSIC_SPECIAL__bittestandset64
 #define __INTRINSIC_SPECIAL__bittestandreset64
 #define __INTRINSIC_SPECIAL__bittestandcomplement64
+#define __INTRINSIC_SPECIAL___movsb
+#define __INTRINSIC_SPECIAL___movsw
+#define __INTRINSIC_SPECIAL___movsd
+#define __INTRINSIC_SPECIAL___movsq
 
 #endif /* __INTRINSIC_GROUP_WINNT */
 
@@ -473,7 +495,7 @@
 #if __INTRINSIC_PROLOG(__stosq)
 __MINGW_EXTENSION void __stosq(unsigned __int64 *, unsigned __int64, size_t);
 __INTRINSICS_USEINLINE 
-__buildstos(__stosq, unsigned __int64)
+__buildstos(__stosq, unsigned __int64, "q")
 #define __INTRINSIC_DEFINED___stosq
 #endif /* __INTRINSIC_PROLOG */
 
@@ -737,6 +759,13 @@
 #define __INTRINSIC_DEFINED___writecr8
 #endif /* __INTRINSIC_PROLOG */
 
+#if __INTRINSIC_PROLOG(__movsq)
+__MINGW_EXTENSION void __movsq(unsigned __int64 *Dest, unsigned __int64 const *Source, size_t Count);
+__MINGW_EXTENSION __INTRINSICS_USEINLINE
+__buildmov(__movsq, unsigned __int64, "q")
+#define __INTRINSIC_DEFINED___movsq
+#endif /* __INTRINSIC_PROLOG */
+
 #endif /* __x86_64__ */
 
 /* ***************************************************** */
@@ -755,21 +784,21 @@
 #if __INTRINSIC_PROLOG(__stosb)
 void __stosb(unsigned char *, unsigned char, size_t);
 __INTRINSICS_USEINLINE 
-__buildstos(__stosb, unsigned char)
+__buildstos(__stosb, unsigned char, "b")
 #define __INTRINSIC_DEFINED___stosb
 #endif /* __INTRINSIC_PROLOG */
 
 #if __INTRINSIC_PROLOG(__stosw)
 void __stosw(unsigned short *, unsigned short, size_t);
 __INTRINSICS_USEINLINE 
-__buildstos(__stosw, unsigned short)
+__buildstos(__stosw, unsigned short, "w")
 #define __INTRINSIC_DEFINED___stosw
 #endif /* __INTRINSIC_PROLOG */
 
 #if __INTRINSIC_PROLOG(__stosd)
 void __stosd(unsigned __LONG32 *, unsigned __LONG32, size_t);
 __INTRINSICS_USEINLINE 
-__buildstos(__stosd, unsigned __LONG32)
+__buildstos(__stosd, unsigned __LONG32, "d")
 #define __INTRINSIC_DEFINED___stosd
 #endif /* __INTRINSIC_PROLOG */
 
@@ -1108,6 +1137,27 @@
 #define __INTRINSIC_DEFINED___writemsr
 #endif /* __INTRINSIC_PROLOG */
 
+#if __INTRINSIC_PROLOG(__movsb)
+void __movsb(unsigned char *Destination, unsigned char const *Source, size_t Count);
+__INTRINSICS_USEINLINE
+__buildmov(__movsb, unsigned char, "b")
+#define __INTRINSIC_DEFINED___movsb
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(__movsw)
+void __movsw(unsigned short *Dest, unsigned short const *Source, size_t Count);
+__INTRINSICS_USEINLINE
+__buildmov(__movsw, unsigned short, "w")
+#define __INTRINSIC_DEFINED___movsw
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(__movsd)
+void __movsd(unsigned __LONG32 *Dest, unsigned __LONG32 const *Source, size_t Count);
+__INTRINSICS_USEINLINE
+__buildmov(__movsd, unsigned __LONG32, "d")
+#define __INTRINSIC_DEFINED___movsd
+#endif /* __INTRINSIC_PROLOG */
+
 #endif /* defined(__x86_64__) || (defined(_X86_) */
 
 /* ***************************************************** */
Index: mingw-w64-headers/include/winnt.h
===================================================================
--- mingw-w64-headers/include/winnt.h	(revision 6265)
+++ mingw-w64-headers/include/winnt.h	(working copy)
@@ -1527,10 +1527,10 @@
 
 #define ReadTimeStampCounter() __rdtsc()
 
-    VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count);
-    VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count);
-    VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count);
-    VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count);
+    /* VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count); moved to psdk_inc/intrin-impl.h */
+    /* VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count); moved to psdk_inc/intrin-impl.h */
+    /* VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count); moved to psdk_inc/intrin-impl.h */
+    /* VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count); moved to psdk_inc/intrin-impl.h */
 
 #define MultiplyHigh __mulh
 #define UnsignedMultiplyHigh __umulh
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to