X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FStg.h;h=a63b7ec2d6f43d980375f2fd9b90c9238c7a3620;hb=c137ecd7e6e83d0f9c39b15ccdb9f2355f243c91;hp=f11f45236435bc9139c67b52b20c02eeea1693c7;hpb=03dc2dd3dd814ad85cc4c45e9cafc7b73163c8be;p=ghc-hetmet.git diff --git a/ghc/includes/Stg.h b/ghc/includes/Stg.h index f11f452..a63b7ec 100644 --- a/ghc/includes/Stg.h +++ b/ghc/includes/Stg.h @@ -367,6 +367,24 @@ INLINE_HEADER StgInt64 PK_Int64(W_ p_src[]) #endif /* ----------------------------------------------------------------------------- + Write-combining store + -------------------------------------------------------------------------- */ + +INLINE_HEADER void +wcStore (StgPtr p, StgWord w) +{ +#ifdef x86_64_HOST_ARCH + __asm__( + "movnti\t%1, %0" + : "=m" (*p) + : "r" (w) + ); +#else + *p = w; +#endif +} + +/* ----------------------------------------------------------------------------- Integer multiply with overflow -------------------------------------------------------------------------- */ @@ -422,15 +440,16 @@ typedef union { #else -#define HALF_INT (((I_)1) << (BITS_IN (I_) / 2)) +/* Approximate version when we don't have long arithmetic (on 64-bit archs) */ -#define stg_abs(a) (((I_)(a)) < 0 ? -((I_)(a)) : ((I_)(a))) +#define HALF_POS_INT (((I_)1) << (BITS_IN (I_) / 2)) +#define HALF_NEG_INT (-HALF_POS_INT) #define mulIntMayOflo(a,b) \ ({ \ I_ c; \ - if (stg_abs(a) >= HALF_INT || \ - stg_abs(b) >= HALF_INT) { \ + if ((I_)a <= HALF_NEG_INT || a >= HALF_POS_INT \ + || (I_)b <= HALF_NEG_INT || b >= HALF_POS_INT) {\ c = 1; \ } else { \ c = 0; \