Lines Matching +full:hi +full:- +full:z

2  * Double-precision SVE log(x) function.
4 * Copyright (c) 2020-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
15 #define Thresh (0x7fe0000000000000) /* Max - Min. */
24 .c0 = -0x1.ffffffffffff7p-2,
25 .c1 = 0x1.55555555170d4p-2,
26 .c2 = -0x1.0000000399c27p-2,
27 .c3 = 0x1.999b2e90e94cap-3,
28 .c4 = -0x1.554e550bd501ep-3,
29 .ln2 = 0x1.62e42fefa39efp-1,
34 special_case (svfloat64_t hi, svuint64_t tmp, svfloat64_t y, svfloat64_t r2, in special_case() argument
37 svfloat64_t x = svreinterpret_f64 (svadd_x (svptrue_b64 (), tmp, d->off)); in special_case()
38 return sv_call_f64 (log, x, svmla_x (svptrue_b64 (), hi, r2, y), special); in special_case()
41 /* Double-precision SVE log routine.
52 /* x = 2^k z; where z is in range [Off,2*Off) and exact. in SV_NAME_D1()
54 The ith subinterval contains z and c is near its center. */ in SV_NAME_D1()
55 svuint64_t tmp = svsub_x (pg, ix, d->off); in SV_NAME_D1()
56 /* Calculate table index = (tmp >> (52 - V_LOG_TABLE_BITS)) % N. in SV_NAME_D1()
59 = svand_x (pg, svlsr_x (pg, tmp, (51 - V_LOG_TABLE_BITS)), (N - 1) << 1); in SV_NAME_D1()
61 svfloat64_t z = svreinterpret_f64 (iz); in SV_NAME_D1() local
66 /* log(x) = log1p(z/c-1) + log(c) + k*Ln2. */ in SV_NAME_D1()
68 /* hi = r + log(c) + k*Ln2. */ in SV_NAME_D1()
69 svfloat64_t ln2_and_c4 = svld1rq_f64 (svptrue_b64 (), &d->ln2); in SV_NAME_D1()
70 svfloat64_t r = svmad_x (pg, invc, z, -1); in SV_NAME_D1()
71 svfloat64_t hi = svmla_lane_f64 (logc, kd, ln2_and_c4, 0); in SV_NAME_D1() local
72 hi = svadd_x (pg, r, hi); in SV_NAME_D1()
74 /* y = r2*(A0 + r*A1 + r2*(A2 + r*A3 + r2*A4)) + hi. */ in SV_NAME_D1()
75 svfloat64_t odd_coeffs = svld1rq_f64 (svptrue_b64 (), &d->c1); in SV_NAME_D1()
77 svfloat64_t y = svmla_lane_f64 (sv_f64 (d->c2), r, odd_coeffs, 1); in SV_NAME_D1()
78 svfloat64_t p = svmla_lane_f64 (sv_f64 (d->c0), r, odd_coeffs, 0); in SV_NAME_D1()
83 return special_case (hi, tmp, y, r2, special, d); in SV_NAME_D1()
84 return svmla_x (pg, hi, r2, y); in SV_NAME_D1()
90 TEST_INTERVAL (SV_NAME_D1 (log), -0.0, -inf, 1000)
91 TEST_INTERVAL (SV_NAME_D1 (log), 0, 0x1p-149, 1000)
92 TEST_INTERVAL (SV_NAME_D1 (log), 0x1p-149, 0x1p-126, 4000)
93 TEST_INTERVAL (SV_NAME_D1 (log), 0x1p-126, 0x1p-23, 50000)
94 TEST_INTERVAL (SV_NAME_D1 (log), 0x1p-23, 1.0, 50000)