_umul128 & _mul128: Moved these intrinsics from library-only to intrin-impl.

dw
Index: mingw-w64-crt/intrincs/_mul128.c
===================================================================
--- mingw-w64-crt/intrincs/_mul128.c	(revision 6265)
+++ mingw-w64-crt/intrincs/_mul128.c	(working copy)
@@ -1,22 +1,10 @@
-#include <_mingw.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.
+ */
 
-#ifdef _WIN64
-#ifndef __SIZEOF_INT128__
-typedef signed int __xint128 __attribute__ ((__mode__ (TI)));
-#else
-typedef signed __int128 __xint128;
-#endif
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__mul128 /* Causes code generation in intrin-impl.h */
 
-__int64 _mul128(__int64, __int64, __int64 *);
-
-__int64 _mul128(__int64 a, __int64 b, __int64 *hi)
-{
-  union { __xint128 v; __int64 sv[2]; } var;
-  var.v = ((__xint128) a) * ((__xint128) b);
-  if (hi) *hi = var.sv[1];
-  return var.sv[0];
-}
-
-#endif /* _WIN64 */
-
-
+#include <intrin.h>
Index: mingw-w64-crt/intrincs/_umul128.c
===================================================================
--- mingw-w64-crt/intrincs/_umul128.c	(revision 6265)
+++ mingw-w64-crt/intrincs/_umul128.c	(working copy)
@@ -1,22 +1,10 @@
-#include <_mingw.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.
+ */
 
-#ifdef _WIN64
-#ifndef __SIZEOF_INT128__
-typedef unsigned int __uint128 __attribute__ ((__mode__ (TI)));
-#else
-typedef unsigned __int128 __uint128;
-#endif
+#define __INTRINSIC_ONLYSPECIAL
+#define __INTRINSIC_SPECIAL__umul128 /* Causes code generation in intrin-impl.h */
 
-unsigned __int64 _umul128(unsigned __int64, unsigned __int64, unsigned __int64 *);
-
-unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b, unsigned __int64 *hi)
-{
-  union { __uint128 v; unsigned __int64 sv[2]; } var;
-  var.v = ((__uint128) a) * ((__uint128) b);
-  if (hi) *hi = var.sv[1];
-  return var.sv[0];
-}
-
-#endif /* _WIN64 */
-
-
+#include <intrin.h>
Index: mingw-w64-headers/crt/intrin.h
===================================================================
--- mingw-w64-headers/crt/intrin.h	(revision 6279)
+++ mingw-w64-headers/crt/intrin.h	(working copy)
@@ -1104,8 +1104,8 @@
     __MACHINEIW64(_CRTIMP wchar_t *__cdecl _wcsset(wchar_t *,wchar_t))
     /* __MACHINEW64(__MINGW_EXTENSION unsigned __int64 __shiftleft128(unsigned __int64 LowPart,unsigned __int64 HighPart,unsigned char Shift)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEW64(__MINGW_EXTENSION unsigned __int64 __shiftright128(unsigned __int64 LowPart,unsigned __int64 HighPart,unsigned char Shift)) moved to psdk_inc/intrin-impl.h */
-    __MACHINEW64(__MINGW_EXTENSION unsigned __int64 _umul128(unsigned __int64 multiplier,unsigned __int64 multiplicand,unsigned __int64 *highproduct))
-    __MACHINEW64(__MINGW_EXTENSION __int64 _mul128(__int64 multiplier,__int64 multiplicand,__int64 *highproduct))
+    /* __MACHINEW64(__MINGW_EXTENSION unsigned __int64 _umul128(unsigned __int64 multiplier,unsigned __int64 multiplicand,unsigned __int64 *highproduct)) moved to psdk_inc/intrin-impl.h */
+    /* __MACHINEW64(__MINGW_EXTENSION __int64 _mul128(__int64 multiplier,__int64 multiplicand,__int64 *highproduct)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEI(void __int2c(void)) moved to psdk_inc/intrin-impl.h */
     /* __MACHINEIW64(void _ReadBarrier(void)) moved to psdk_inc/intrin-impl.h */
     __MACHINEIW64(unsigned char _rotr8(unsigned char value,unsigned char shift))
Index: mingw-w64-headers/include/psdk_inc/intrin-impl.h
===================================================================
--- mingw-w64-headers/include/psdk_inc/intrin-impl.h	(revision 6279)
+++ mingw-w64-headers/include/psdk_inc/intrin-impl.h	(working copy)
@@ -766,6 +766,34 @@
 #define __INTRINSIC_DEFINED___movsq
 #endif /* __INTRINSIC_PROLOG */
 
+#if __INTRINSIC_PROLOG(_umul128)
+unsigned __int64 _umul128(unsigned __int64, unsigned __int64, unsigned __int64 *);
+__INTRINSICS_USEINLINE
+unsigned __int64 _umul128(unsigned __int64 a, unsigned __int64 b, unsigned __int64 *hi)
+{
+   __MINGW_EXTENSION union { unsigned __int128 v; unsigned __int64 sv[2]; } var;
+   var.v = a;
+   var.v *= b;
+   if (hi) *hi = var.sv[1];
+   return var.sv[0];
+}
+#define __INTRINSIC_DEFINED__umul128
+#endif /* __INTRINSIC_PROLOG */
+
+#if __INTRINSIC_PROLOG(_mul128)
+__int64 _mul128(__int64, __int64, __int64 *);
+__INTRINSICS_USEINLINE
+__int64 _mul128(__int64 a, __int64 b, __int64 *hi)
+{
+   __MINGW_EXTENSION union { __int128 v; __int64 sv[2]; } var;
+   var.v = a;
+   var.v *= b;
+   if (hi) *hi = var.sv[1];
+   return var.sv[0];
+}
+#define __INTRINSIC_DEFINED__mul128
+#endif /* __INTRINSIC_PROLOG */
+
 #if __INTRINSIC_PROLOG(__shiftleft128)
 unsigned __int64 __shiftleft128(unsigned __int64  LowPart, unsigned __int64 HighPart, unsigned char Shift);
 __INTRINSICS_USEINLINE
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to