From aa2fa89e6c41b5431f8885a92ded01e12f2f137d Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Mon, 19 Apr 2021 00:35:19 +0300 Subject: [PATCH] arm: fma msub and nmsub --- include/cglm/simd/arm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/cglm/simd/arm.h b/include/cglm/simd/arm.h index 2c2b845..1153694 100644 --- a/include/cglm/simd/arm.h +++ b/include/cglm/simd/arm.h @@ -99,5 +99,21 @@ glmm_fnmadd(float32x4_t a, float32x4_t b, float32x4_t c) { #endif } +static inline +float32x4_t +glmm_fmsub(float32x4_t a, float32x4_t b, float32x4_t c) { +#if defined(__aarch64__) + return vfmsq_f32(c, a, b); +#else + return vmlsq_f32(c, a, b); +#endif +} + +static inline +float32x4_t +glmm_fnmsub(float32x4_t a, float32x4_t b, float32x4_t c) { + return vsubq_f32(vdupq_n_f32(0.0f), glmm_fmadd(a, b, c)); +} + #endif #endif /* cglm_simd_arm_h */