From: Billy Laws <blaw...@gmail.com> --- mingw-w64-crt/math/fma.c | 2 +- mingw-w64-crt/math/fmaf.c | 2 +- mingw-w64-crt/math/llrint.c | 2 +- mingw-w64-crt/math/llrintf.c | 2 +- mingw-w64-crt/math/llrintl.c | 3 ++- mingw-w64-crt/math/lrint.c | 14 +++++++------- mingw-w64-crt/math/lrintf.c | 14 +++++++------- mingw-w64-crt/math/modf.c | 2 +- mingw-w64-crt/math/modff.c | 2 +- mingw-w64-crt/math/modfl.c | 2 +- mingw-w64-crt/math/signbitl.c | 4 ++-- mingw-w64-crt/math/sqrt.def.h | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/mingw-w64-crt/math/fma.c b/mingw-w64-crt/math/fma.c index 6774be787..644a6f6b7 100644 --- a/mingw-w64-crt/math/fma.c +++ b/mingw-w64-crt/math/fma.c @@ -17,7 +17,7 @@ double fma(double x, double y, double z){ return z; } -#elif defined(_ARM64_) || defined(__aarch64__) +#elif defined(_ARM64_) || defined(__aarch64__) || defined(_ARM64EC_) || defined(__arm64ec__) /* Use hardware FMA on ARM64. */ double fma(double x, double y, double z){ diff --git a/mingw-w64-crt/math/fmaf.c b/mingw-w64-crt/math/fmaf.c index 4661e4b82..2773c5435 100644 --- a/mingw-w64-crt/math/fmaf.c +++ b/mingw-w64-crt/math/fmaf.c @@ -17,7 +17,7 @@ float fmaf(float x, float y, float z){ return z; } -#elif defined(_ARM64_) || defined(__aarch64__) +#elif defined(_ARM64_) || defined(__aarch64__) || defined(_ARM64EC_) || defined(__arm64ec__) /* Use hardware FMA on ARM64. */ float fmaf(float x, float y, float z){ diff --git a/mingw-w64-crt/math/llrint.c b/mingw-w64-crt/math/llrint.c index 4ba7af7e6..6b8b02a60 100644 --- a/mingw-w64-crt/math/llrint.c +++ b/mingw-w64-crt/math/llrint.c @@ -9,7 +9,7 @@ long long llrint (double x) { long long retval = 0ll; -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) || defined(_X86_) || defined(__i386__) __asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); #else int mode = fegetround(); diff --git a/mingw-w64-crt/math/llrintf.c b/mingw-w64-crt/math/llrintf.c index e8085ec4e..38f7c3c2f 100644 --- a/mingw-w64-crt/math/llrintf.c +++ b/mingw-w64-crt/math/llrintf.c @@ -9,7 +9,7 @@ long long llrintf (float x) { long long retval = 0ll; -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) || defined(_X86_) || defined(__i386__) __asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); #else int mode = fegetround(); diff --git a/mingw-w64-crt/math/llrintl.c b/mingw-w64-crt/math/llrintl.c index 6a2bf73d8..027686a92 100644 --- a/mingw-w64-crt/math/llrintl.c +++ b/mingw-w64-crt/math/llrintl.c @@ -9,7 +9,8 @@ long long llrintl (long double x) { long long retval = 0ll; -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) || \ + defined(_X86_) || defined(__i386__) __asm__ __volatile__ ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); #else int mode = fegetround(); diff --git a/mingw-w64-crt/math/lrint.c b/mingw-w64-crt/math/lrint.c index 7831446be..a84e71426 100644 --- a/mingw-w64-crt/math/lrint.c +++ b/mingw-w64-crt/math/lrint.c @@ -5,14 +5,19 @@ */ #include <math.h> -#if defined(_AMD64_) || defined(__x86_64__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) #include <xmmintrin.h> #endif long lrint (double x) { long retval = 0L; -#if defined(_AMD64_) || defined(__x86_64__) +#if defined(__aarch64__) || defined(_ARM64_) || defined(__arm64ec__) || defined(_ARM64EC_) + __asm__ __volatile__ ( + "frintx %d1, %d1\n\t" + "fcvtzs %w0, %d1\n\t" + : "=r" (retval), "+w" (x)); +#elif defined(_AMD64_) || defined(__x86_64__) retval = _mm_cvtsd_si32(_mm_load_sd(&x)); #elif defined(_X86_) || defined(__i386__) __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); @@ -22,11 +27,6 @@ long lrint (double x) "vcvtr.s32.f64 %[tmp], %[src]\n\t" "fmrs %[dst], %[tmp]\n\t" : [dst] "=r" (retval), [tmp] "=t" (temp) : [src] "w" (x)); -#elif defined(__aarch64__) || defined(_ARM64_) - __asm__ __volatile__ ( - "frintx %d1, %d1\n\t" - "fcvtzs %w0, %d1\n\t" - : "=r" (retval), "+w" (x)); #endif return retval; } diff --git a/mingw-w64-crt/math/lrintf.c b/mingw-w64-crt/math/lrintf.c index 1e8902f03..27c9b304f 100644 --- a/mingw-w64-crt/math/lrintf.c +++ b/mingw-w64-crt/math/lrintf.c @@ -5,14 +5,19 @@ */ #include <math.h> -#if defined(_AMD64_) || defined(__x86_64__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) #include <xmmintrin.h> #endif long lrintf (float x) { long retval = 0l; -#if defined(_AMD64_) || defined(__x86_64__) +#if defined(__aarch64__) || defined(_ARM64_) || defined(__arm64ec__) || defined(_ARM64EC_) + __asm__ __volatile__ ( + "frintx %s1, %s1\n\t" + "fcvtzs %w0, %s1\n\t" + : "=r" (retval), "+w" (x)); +#elif defined(_AMD64_) || defined(__x86_64__) retval = _mm_cvtss_si32(_mm_load_ss(&x)); #elif defined(_X86_) || defined(__i386__) __asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); @@ -21,11 +26,6 @@ long lrintf (float x) "vcvtr.s32.f32 %[src], %[src]\n\t" "fmrs %[dst], %[src]\n\t" : [dst] "=r" (retval), [src] "+w" (x)); -#elif defined(__aarch64__) || defined(_ARM64_) - __asm__ __volatile__ ( - "frintx %s1, %s1\n\t" - "fcvtzs %w0, %s1\n\t" - : "=r" (retval), "+w" (x)); #endif return retval; } diff --git a/mingw-w64-crt/math/modf.c b/mingw-w64-crt/math/modf.c index d2623095c..bf541fad2 100644 --- a/mingw-w64-crt/math/modf.c +++ b/mingw-w64-crt/math/modf.c @@ -12,7 +12,7 @@ modf (double value, double* iptr) { double int_part = 0.0; /* truncate */ -#if defined(_AMD64_) || defined(__x86_64__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" diff --git a/mingw-w64-crt/math/modff.c b/mingw-w64-crt/math/modff.c index dcf19cfed..d2f8514d4 100644 --- a/mingw-w64-crt/math/modff.c +++ b/mingw-w64-crt/math/modff.c @@ -13,7 +13,7 @@ modff (float value, float* iptr) float int_part = 0.0F; /* truncate */ /* truncate */ -#if defined(_AMD64_) || defined(__x86_64__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" diff --git a/mingw-w64-crt/math/modfl.c b/mingw-w64-crt/math/modfl.c index 33593e6de..60b9b81b9 100644 --- a/mingw-w64-crt/math/modfl.c +++ b/mingw-w64-crt/math/modfl.c @@ -12,7 +12,7 @@ modfl (long double value, long double* iptr) { long double int_part = 0.0L; /* truncate */ -#if defined(_AMD64_) || defined(__x86_64__) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) asm volatile ("subq $8, %%rsp\n" "fnstcw 4(%%rsp)\n" "movzwl 4(%%rsp), %%eax\n" diff --git a/mingw-w64-crt/math/signbitl.c b/mingw-w64-crt/math/signbitl.c index 19f2938db..b4dba713b 100644 --- a/mingw-w64-crt/math/signbitl.c +++ b/mingw-w64-crt/math/signbitl.c @@ -9,11 +9,11 @@ int __signbitl (long double x) { -#if defined(__x86_64__) || defined(_AMD64_) +#if (defined(_AMD64_) && !defined(_ARM64EC_)) || (defined(__x86_64__) && !defined(__arm64ec__)) __mingw_ldbl_type_t ld; ld.x = x; return ((ld.lh.sign_exponent & 0x8000) != 0); -#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) +#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) || defined(__arm64ec__) || defined(_ARM64EC_) return __signbit(x); #elif defined(__i386__) || defined(_X86_) unsigned short sw; diff --git a/mingw-w64-crt/math/sqrt.def.h b/mingw-w64-crt/math/sqrt.def.h index ed1e663ba..43bd5a37d 100644 --- a/mingw-w64-crt/math/sqrt.def.h +++ b/mingw-w64-crt/math/sqrt.def.h @@ -77,7 +77,7 @@ __FLT_ABI (sqrt) (__FLT_TYPE x) #else asm volatile ("fsqrtd %[dst], %[src];\n" : [dst] "=w" (res) : [src] "w" (x)); #endif -#elif defined(__aarch64__) || defined(_ARM64_) +#elif defined(__aarch64__) || defined(_ARM64_) || defined(__arm64ec__) || defined(_ARM64EC_) #if _NEW_COMPLEX_FLOAT asm volatile ("fsqrt %s[dst], %s[src]\n" : [dst] "=w" (res) : [src] "w" (x)); #else -- 2.48.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public