Lines Matching +full:half +full:- +full:precision
1 // SPDX-License-Identifier: GPL-2.0
36 * Computes an estimate of 2^x. The `s' argument is the 32-bit
37 * single-precision floating-point representation of x.
45 exp = ((s >> 23) & 0xff) - 127; in eexp2()
50 /* 2^-big = 0, 2^+big = +Inf */ in eexp2()
53 if (exp < -23) in eexp2()
61 pwr >>= -exp; in eexp2()
63 pwr = -pwr; in eexp2()
69 if (exp < -23) in eexp2()
85 exp = -exp; in eexp2()
86 mant += 1 << (exp - 1); in eexp2()
91 * Computes an estimate of log_2(x). The `s' argument is the 32-bit
92 * single-precision floating-point representation of x.
105 if ((exp | mant) == 0) /* +0 or -0 */ in elog2()
106 return 0xff800000; /* return -Inf */ in elog2()
111 mant <<= lz - 8; in elog2()
112 exp = (-118 - lz) << 23; in elog2()
115 exp -= 127 << 23; in elog2()
121 : "r" (mant), "r" (0xb504f334)); /* 2^-0.5 * 2^32 */ in elog2()
126 : "r" (mant), "r" (0xd744fccb)); /* 2^-0.25 * 2^32 */ in elog2()
131 : "r" (mant), "r" (0xeac0c6e8)); /* 2^-0.125 * 2^32 */ in elog2()
134 /* calculate (mant - 1) * 1.381097463 */ in elog2()
135 /* 1.381097463 == 0.125 / (2^0.125 - 1) */ in elog2()
137 : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a)); in elog2()
143 exp = -exp; in elog2()
145 lz = 8 - lz; in elog2()
149 exp <<= -lz; in elog2()
164 return 0; /* NaN -> 0 */ in ctsxs()
165 exp = exp - 127 + scale; in ctsxs()
169 /* saturate, unless the result would be -2^31 */ in ctsxs()
175 mant = (mant << 7) >> (30 - exp); in ctsxs()
176 return (x & 0x80000000)? -mant: mant; in ctsxs()
187 return 0; /* NaN -> 0 */ in ctuxs()
188 exp = exp - 127 + scale; in ctuxs()
202 mant = (mant << 8) >> (31 - exp); in ctuxs()
211 exp = ((x >> 23) & 0xff) - 127; in rfiz()
213 return x | 0x400000; /* NaN -> make it a QNaN */ in rfiz()
221 /* Round to floating integer, towards +/- Inf */
226 exp = ((x >> 23) & 0xff) - 127; in rfii()
228 return x | 0x400000; /* NaN -> make it a QNaN */ in rfii()
232 return x; /* +/-0 -> +/-0 */ in rfii()
234 /* 0 < |x| < 1.0 rounds to +/- 1.0 */ in rfii()
237 /* mantissa overflows into exponent - that's OK, in rfii()
245 int exp, half; in rfin() local
247 exp = ((x >> 23) & 0xff) - 127; in rfin()
249 return x | 0x400000; /* NaN -> make it a QNaN */ in rfin()
252 if (exp < -1) in rfin()
253 return x & 0x80000000; /* |x| < 0.5 -> +/-0 */ in rfin()
254 if (exp == -1) in rfin()
255 /* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */ in rfin()
257 half = 0x400000 >> exp; in rfin()
259 return (x + half) & ~(0x7fffff >> exp); in rfin()
269 if (get_user_instr(instr, (void __user *)regs->nip)) in emulate_altivec()
270 return -EFAULT; in emulate_altivec()
274 return -EINVAL; /* not an altivec instruction */ in emulate_altivec()
280 vrs = current->thread.vr_state.vr; in emulate_altivec()
329 ¤t->thread.vr_state.vscr.u[3]); in emulate_altivec()
334 ¤t->thread.vr_state.vscr.u[3]); in emulate_altivec()
337 return -EINVAL; in emulate_altivec()
347 return -EINVAL; in emulate_altivec()