Skip to content

Commit

Permalink
add generic branch for macro
Browse files Browse the repository at this point in the history
git-svn-id: https://msieve.svn.sourceforge.net/svnroot/msieve/trunk@221 8c02911e-0617-4013-80d0-c3bcbcae04d5
  • Loading branch information
jasonp_sf committed Feb 21, 2010
1 parent 1d2c7f4 commit 6b71ea9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gnfs/poly/stage1/stage1_core/cpu_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,30 @@ modsub128(uint128 a, uint128 b, uint128 p)

/*------------------- Montgomery arithmetic --------------------------*/
#ifdef _MSC_VER
#include <intrin.h>
#pragma intrinsic(__emulu)

#include <intrin.h>
#pragma intrinsic(__emulu)

#define PROD32(hi, lo, a, b) \
{ uint64 __t = __emulu(a,b); \
hi = (uint32)(__t >> 32); \
lo = (uint32)(__t); }

#else
#elif defined(GCC_ASM32X)

#define PROD32(hi, lo, a, b) \
asm("mull %2 \n\t" \
:"=d"(hi), "=a"(lo) \
:"%rm"(a), "1"(b) \
:"cc")

#else

#define PROD32(hi, lo, a, b) \
{ uint64 t = (uint64)(a) * (b); \
hi = (uint32)(t >> 32); \
lo = (uint32)(t); }

#endif

static INLINE uint64
Expand Down

0 comments on commit 6b71ea9

Please sign in to comment.