diff options
author | ed <ed@FreeBSD.org> | 2011-12-31 19:01:48 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2011-12-31 19:01:48 +0000 |
commit | 0ece074de9d070fa87b7f58f9e96bce63db862d8 (patch) | |
tree | 21b838383a703c249dd4f0180c8566c40f70e0e3 /contrib/compiler-rt/lib/divsc3.c | |
parent | 55bd70ed9a164b6b2d84037c8362ff3725ff294b (diff) | |
parent | 6a5f9bc9ae3205be8bb5570b86a509fcd01a9db6 (diff) | |
download | FreeBSD-src-0ece074de9d070fa87b7f58f9e96bce63db862d8.zip FreeBSD-src-0ece074de9d070fa87b7f58f9e96bce63db862d8.tar.gz |
Upgrade libcompiler_rt to upstream revision 147390.
This version of libcompiler_rt adds support for __mulo[sdt]i4(), which
computes a multiply and its overflow flag. There are also a lot of
cleanup fixes to headers that don't really affect us.
Updating to this revision should make it a bit easier to contribute
changes back to the LLVM developers.
Diffstat (limited to 'contrib/compiler-rt/lib/divsc3.c')
-rw-r--r-- | contrib/compiler-rt/lib/divsc3.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/contrib/compiler-rt/lib/divsc3.c b/contrib/compiler-rt/lib/divsc3.c index a05f429..caa0c407 100644 --- a/contrib/compiler-rt/lib/divsc3.c +++ b/contrib/compiler-rt/lib/divsc3.c @@ -13,8 +13,7 @@ */ #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the quotient of (a + ib) / (c + id) */ @@ -22,35 +21,37 @@ float _Complex __divsc3(float __a, float __b, float __c, float __d) { int __ilogbw = 0; - float __logbw = logbf(fmaxf(fabsf(__c), fabsf(__d))); - if (isfinite(__logbw)) + float __logbw = crt_logbf(crt_fmaxf(crt_fabsf(__c), crt_fabsf(__d))); + if (crt_isfinite(__logbw)) { __ilogbw = (int)__logbw; - __c = scalbnf(__c, -__ilogbw); - __d = scalbnf(__d, -__ilogbw); + __c = crt_scalbnf(__c, -__ilogbw); + __d = crt_scalbnf(__d, -__ilogbw); } float __denom = __c * __c + __d * __d; float _Complex z; - __real__ z = scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw); - __imag__ z = scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw); - if (isnan(__real__ z) && isnan(__imag__ z)) + __real__ z = crt_scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw); + __imag__ z = crt_scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw); + if (crt_isnan(__real__ z) && crt_isnan(__imag__ z)) { - if ((__denom == 0) && (!isnan(__a) || !isnan(__b))) + if ((__denom == 0) && (!crt_isnan(__a) || !crt_isnan(__b))) { - __real__ z = copysignf(INFINITY, __c) * __a; - __imag__ z = copysignf(INFINITY, __c) * __b; + __real__ z = crt_copysignf(CRT_INFINITY, __c) * __a; + __imag__ z = crt_copysignf(CRT_INFINITY, __c) * __b; } - else if ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d)) + else if ((crt_isinf(__a) || crt_isinf(__b)) && + crt_isfinite(__c) && crt_isfinite(__d)) { - __a = copysignf(isinf(__a) ? 1 : 0, __a); - __b = copysignf(isinf(__b) ? 1 : 0, __b); - __real__ z = INFINITY * (__a * __c + __b * __d); - __imag__ z = INFINITY * (__b * __c - __a * __d); + __a = crt_copysignf(crt_isinf(__a) ? 1 : 0, __a); + __b = crt_copysignf(crt_isinf(__b) ? 1 : 0, __b); + __real__ z = CRT_INFINITY * (__a * __c + __b * __d); + __imag__ z = CRT_INFINITY * (__b * __c - __a * __d); } - else if (isinf(__logbw) && __logbw > 0 && isfinite(__a) && isfinite(__b)) + else if (crt_isinf(__logbw) && __logbw > 0 && + crt_isfinite(__a) && crt_isfinite(__b)) { - __c = copysignf(isinf(__c) ? 1 : 0, __c); - __d = copysignf(isinf(__d) ? 1 : 0, __d); + __c = crt_copysignf(crt_isinf(__c) ? 1 : 0, __c); + __d = crt_copysignf(crt_isinf(__d) ? 1 : 0, __d); __real__ z = 0 * (__a * __c + __b * __d); __imag__ z = 0 * (__b * __c - __a * __d); } |