diff options
author | Marat Dukhan <maratek@google.com> | 2022-08-02 12:45:05 -0700 |
---|---|---|
committer | XNNPACK Team <xnnpack-github-robot@google.com> | 2022-08-02 12:46:03 -0700 |
commit | 6a86ec7b37dba13f501cc259dc7363eb1abd4c5f (patch) | |
tree | 6f0808d822cd1abc322ea75b82880359eeeba273 | |
parent | 20e1c69b795e367ef484909e53026cb12796a8ea (diff) | |
download | XNNPACK-6a86ec7b37dba13f501cc259dc7363eb1abd4c5f.tar.gz |
Add extended multiplication math functions
PiperOrigin-RevId: 464862484
-rw-r--r-- | src/xnnpack/math.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/xnnpack/math.h b/src/xnnpack/math.h index 6218b2db6..8f374cc9c 100644 --- a/src/xnnpack/math.h +++ b/src/xnnpack/math.h @@ -101,6 +101,22 @@ XNN_INLINE static uint32_t math_max_u32(uint32_t a, uint32_t b) { return XNN_UNPREDICTABLE(a > b) ? a : b; } +XNN_INLINE static int64_t math_mulext_s32(int32_t a, int32_t b) { +#if defined(_MSC_VER) && defined(_M_IX86) + return (int64_t) __emul((int) a, (int) b); +#else + return (int64_t) a * (int64_t) b; +#endif +} + +XNN_INLINE static uint64_t math_mulext_u32(uint32_t a, uint32_t b) { +#if defined(_MSC_VER) && defined(_M_IX86) + return (uint64_t) __emulu((unsigned int) a, (unsigned int) b); +#else + return (uint64_t) a * (uint64_t) b; +#endif +} + XNN_INLINE static float math_muladd_f32(float x, float y, float acc) { #if defined(__GNUC__) && defined(__FP_FAST_FMAF) return __builtin_fmaf(x, y, acc); |