summaryrefslogtreecommitdiff
path: root/pl/math/sv_powif.c
diff options
context:
space:
mode:
Diffstat (limited to 'pl/math/sv_powif.c')
-rw-r--r--pl/math/sv_powif.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/pl/math/sv_powif.c b/pl/math/sv_powif.c
index d0567e393927..7e032fd86a20 100644
--- a/pl/math/sv_powif.c
+++ b/pl/math/sv_powif.c
@@ -6,23 +6,22 @@
*/
#include "sv_math.h"
-#if SV_SUPPORTED
/* Optimized single-precision vector powi (float base, integer power).
powi is developed for environments in which accuracy is of much less
importance than performance, hence we provide no estimate for worst-case
error. */
svfloat32_t
-__sv_powif_x (svfloat32_t as, svint32_t ns, svbool_t p)
+_ZGVsMxvv_powi (svfloat32_t as, svint32_t ns, svbool_t p)
{
/* Compute powi by successive squaring, right to left. */
- svfloat32_t acc = svdup_n_f32 (1.f);
- svbool_t want_recip = svcmplt_n_s32 (p, ns, 0);
- svuint32_t ns_abs = svreinterpret_u32_s32 (svabs_s32_x (p, ns));
+ svfloat32_t acc = sv_f32 (1.f);
+ svbool_t want_recip = svcmplt (p, ns, 0);
+ svuint32_t ns_abs = svreinterpret_u32 (svabs_x (p, ns));
/* We use a max to avoid needing to check whether any lane != 0 on each
iteration. */
- uint32_t max_n = svmaxv_u32 (p, ns_abs);
+ uint32_t max_n = svmaxv (p, ns_abs);
svfloat32_t c = as;
/* Successively square c, and use merging predication (_m) to determine
@@ -30,25 +29,20 @@ __sv_powif_x (svfloat32_t as, svint32_t ns, svbool_t p)
iteration. */
while (true)
{
- svbool_t px = svcmpeq_n_u32 (p, svand_n_u32_x (p, ns_abs, 1), 1);
- acc = svmul_f32_m (px, acc, c);
+ svbool_t px = svcmpeq (p, svand_x (p, ns_abs, 1), 1);
+ acc = svmul_m (px, acc, c);
max_n >>= 1;
if (max_n == 0)
break;
- ns_abs = svlsr_n_u32_x (p, ns_abs, 1);
- c = svmul_f32_x (p, c, c);
+ ns_abs = svlsr_x (p, ns_abs, 1);
+ c = svmul_x (p, c, c);
}
/* Negative powers are handled by computing the abs(n) version and then
taking the reciprocal. */
if (svptest_any (want_recip, want_recip))
- acc = svdivr_n_f32_m (want_recip, acc, 1.0f);
+ acc = svdivr_m (want_recip, acc, 1.0f);
return acc;
}
-
-/* Note no trailing f for ZGV... name - 64-bit integer version is powk. */
-strong_alias (__sv_powif_x, _ZGVsMxvv_powi)
-
-#endif // SV_SUPPORTED