[llvm-commits] [compiler-rt] r144786 - in /compiler-rt/trunk: lib/divdc3.c lib/divsc3.c lib/divxc3.c lib/int_lib.h lib/int_math.h lib/muldc3.c lib/mulsc3.c lib/mulxc3.c lib/ppc/divtc3.c lib/ppc/fixtfdi.c lib/ppc/multc3.c make/platform/clang_darwin_test_input.c
Daniel Dunbar
daniel at zuster.org
Tue Nov 15 23:33:06 PST 2011
Author: ddunbar
Date: Wed Nov 16 01:33:06 2011
New Revision: 144786
URL: http://llvm.org/viewvc/llvm-project?rev=144786&view=rev
Log:
lib: Finish int_math.h definitions using compiler builtins and eliminate
implementation use of <math.h>.
Modified:
compiler-rt/trunk/lib/divdc3.c
compiler-rt/trunk/lib/divsc3.c
compiler-rt/trunk/lib/divxc3.c
compiler-rt/trunk/lib/int_lib.h
compiler-rt/trunk/lib/int_math.h
compiler-rt/trunk/lib/muldc3.c
compiler-rt/trunk/lib/mulsc3.c
compiler-rt/trunk/lib/mulxc3.c
compiler-rt/trunk/lib/ppc/divtc3.c
compiler-rt/trunk/lib/ppc/fixtfdi.c
compiler-rt/trunk/lib/ppc/multc3.c
compiler-rt/trunk/make/platform/clang_darwin_test_input.c
Modified: compiler-rt/trunk/lib/divdc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divdc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divdc3.c (original)
+++ compiler-rt/trunk/lib/divdc3.c Wed Nov 16 01:33:06 2011
@@ -14,7 +14,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the quotient of (a + ib) / (c + id) */
@@ -22,37 +21,37 @@
__divdc3(double __a, double __b, double __c, double __d)
{
int __ilogbw = 0;
- double __logbw = logb(fmax(fabs(__c), fabs(__d)));
+ double __logbw = crt_logb(crt_fmax(crt_fabs(__c), crt_fabs(__d)));
if (crt_isfinite(__logbw))
{
__ilogbw = (int)__logbw;
- __c = scalbn(__c, -__ilogbw);
- __d = scalbn(__d, -__ilogbw);
+ __c = crt_scalbn(__c, -__ilogbw);
+ __d = crt_scalbn(__d, -__ilogbw);
}
double __denom = __c * __c + __d * __d;
double _Complex z;
- __real__ z = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
- __imag__ z = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
+ __real__ z = crt_scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
+ __imag__ z = crt_scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
if (crt_isnan(__real__ z) && crt_isnan(__imag__ z))
{
if ((__denom == 0.0) && (!crt_isnan(__a) || !crt_isnan(__b)))
{
- __real__ z = copysign(INFINITY, __c) * __a;
- __imag__ z = copysign(INFINITY, __c) * __b;
+ __real__ z = crt_copysign(CRT_INFINITY, __c) * __a;
+ __imag__ z = crt_copysign(CRT_INFINITY, __c) * __b;
}
else if ((crt_isinf(__a) || crt_isinf(__b)) &&
crt_isfinite(__c) && crt_isfinite(__d))
{
- __a = copysign(crt_isinf(__a) ? 1.0 : 0.0, __a);
- __b = copysign(crt_isinf(__b) ? 1.0 : 0.0, __b);
- __real__ z = INFINITY * (__a * __c + __b * __d);
- __imag__ z = INFINITY * (__b * __c - __a * __d);
+ __a = crt_copysign(crt_isinf(__a) ? 1.0 : 0.0, __a);
+ __b = crt_copysign(crt_isinf(__b) ? 1.0 : 0.0, __b);
+ __real__ z = CRT_INFINITY * (__a * __c + __b * __d);
+ __imag__ z = CRT_INFINITY * (__b * __c - __a * __d);
}
else if (crt_isinf(__logbw) && __logbw > 0.0 &&
crt_isfinite(__a) && crt_isfinite(__b))
{
- __c = copysign(crt_isinf(__c) ? 1.0 : 0.0, __c);
- __d = copysign(crt_isinf(__d) ? 1.0 : 0.0, __d);
+ __c = crt_copysign(crt_isinf(__c) ? 1.0 : 0.0, __c);
+ __d = crt_copysign(crt_isinf(__d) ? 1.0 : 0.0, __d);
__real__ z = 0.0 * (__a * __c + __b * __d);
__imag__ z = 0.0 * (__b * __c - __a * __d);
}
Modified: compiler-rt/trunk/lib/divsc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divsc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divsc3.c (original)
+++ compiler-rt/trunk/lib/divsc3.c Wed Nov 16 01:33:06 2011
@@ -14,7 +14,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the quotient of (a + ib) / (c + id) */
@@ -22,37 +21,37 @@
__divsc3(float __a, float __b, float __c, float __d)
{
int __ilogbw = 0;
- float __logbw = logbf(fmaxf(fabsf(__c), fabsf(__d)));
+ 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);
+ __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) && (!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 ((crt_isinf(__a) || crt_isinf(__b)) &&
crt_isfinite(__c) && crt_isfinite(__d))
{
- __a = copysignf(crt_isinf(__a) ? 1 : 0, __a);
- __b = copysignf(crt_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 (crt_isinf(__logbw) && __logbw > 0 &&
crt_isfinite(__a) && crt_isfinite(__b))
{
- __c = copysignf(crt_isinf(__c) ? 1 : 0, __c);
- __d = copysignf(crt_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);
}
Modified: compiler-rt/trunk/lib/divxc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/divxc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/divxc3.c (original)
+++ compiler-rt/trunk/lib/divxc3.c Wed Nov 16 01:33:06 2011
@@ -15,7 +15,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the quotient of (a + ib) / (c + id) */
@@ -23,37 +22,37 @@
__divxc3(long double __a, long double __b, long double __c, long double __d)
{
int __ilogbw = 0;
- long double __logbw = logbl(fmaxl(fabsl(__c), fabsl(__d)));
+ long double __logbw = crt_logbl(crt_fmaxl(crt_fabsl(__c), crt_fabsl(__d)));
if (crt_isfinite(__logbw))
{
__ilogbw = (int)__logbw;
- __c = scalbnl(__c, -__ilogbw);
- __d = scalbnl(__d, -__ilogbw);
+ __c = crt_scalbnl(__c, -__ilogbw);
+ __d = crt_scalbnl(__d, -__ilogbw);
}
long double __denom = __c * __c + __d * __d;
long double _Complex z;
- __real__ z = scalbnl((__a * __c + __b * __d) / __denom, -__ilogbw);
- __imag__ z = scalbnl((__b * __c - __a * __d) / __denom, -__ilogbw);
+ __real__ z = crt_scalbnl((__a * __c + __b * __d) / __denom, -__ilogbw);
+ __imag__ z = crt_scalbnl((__b * __c - __a * __d) / __denom, -__ilogbw);
if (crt_isnan(__real__ z) && crt_isnan(__imag__ z))
{
if ((__denom == 0) && (!crt_isnan(__a) || !crt_isnan(__b)))
{
- __real__ z = copysignl(INFINITY, __c) * __a;
- __imag__ z = copysignl(INFINITY, __c) * __b;
+ __real__ z = crt_copysignl(CRT_INFINITY, __c) * __a;
+ __imag__ z = crt_copysignl(CRT_INFINITY, __c) * __b;
}
else if ((crt_isinf(__a) || crt_isinf(__b)) &&
crt_isfinite(__c) && crt_isfinite(__d))
{
- __a = copysignl(crt_isinf(__a) ? 1 : 0, __a);
- __b = copysignl(crt_isinf(__b) ? 1 : 0, __b);
- __real__ z = INFINITY * (__a * __c + __b * __d);
- __imag__ z = INFINITY * (__b * __c - __a * __d);
+ __a = crt_copysignl(crt_isinf(__a) ? 1 : 0, __a);
+ __b = crt_copysignl(crt_isinf(__b) ? 1 : 0, __b);
+ __real__ z = CRT_INFINITY * (__a * __c + __b * __d);
+ __imag__ z = CRT_INFINITY * (__b * __c - __a * __d);
}
else if (crt_isinf(__logbw) && __logbw > 0 &&
crt_isfinite(__a) && crt_isfinite(__b))
{
- __c = copysignl(crt_isinf(__c) ? 1 : 0, __c);
- __d = copysignl(crt_isinf(__d) ? 1 : 0, __d);
+ __c = crt_copysignl(crt_isinf(__c) ? 1 : 0, __c);
+ __d = crt_copysignl(crt_isinf(__d) ? 1 : 0, __d);
__real__ z = 0 * (__a * __c + __b * __d);
__imag__ z = 0 * (__b * __c - __a * __d);
}
Modified: compiler-rt/trunk/lib/int_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/int_lib.h?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/int_lib.h (original)
+++ compiler-rt/trunk/lib/int_lib.h Wed Nov 16 01:33:06 2011
@@ -37,10 +37,6 @@
#include <stdbool.h>
#include <float.h>
-#if !defined(INFINITY) && defined(HUGE_VAL)
-#define INFINITY HUGE_VAL
-#endif /* INFINITY */
-
/* Include the commonly used internal type definitions. */
#include "int_types.h"
Modified: compiler-rt/trunk/lib/int_math.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/int_math.h?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/int_math.h (original)
+++ compiler-rt/trunk/lib/int_math.h Wed Nov 16 01:33:06 2011
@@ -21,8 +21,30 @@
#ifndef INT_MATH_H
#define INT_MATH_H
+#define CRT_INFINITY __builtin_huge_valf()
+
#define crt_isfinite(x) __builtin_isfinite((x))
#define crt_isinf(x) __builtin_isinf((x))
#define crt_isnan(x) __builtin_isnan((x))
+#define crt_copysign(x, y) __builtin_copysign((x), (y))
+#define crt_copysignf(x, y) __builtin_copysignf((x), (y))
+#define crt_copysignl(x, y) __builtin_copysignl((x), (y))
+
+#define crt_fabs(x) __builtin_fabs((x))
+#define crt_fabsf(x) __builtin_fabsf((x))
+#define crt_fabsl(x) __builtin_fabsl((x))
+
+#define crt_fmax(x, y) __builtin_fmax((x), (y))
+#define crt_fmaxf(x, y) __builtin_fmaxf((x), (y))
+#define crt_fmaxl(x, y) __builtin_fmaxl((x), (y))
+
+#define crt_logb(x) __builtin_logb((x))
+#define crt_logbf(x) __builtin_logbf((x))
+#define crt_logbl(x) __builtin_logbl((x))
+
+#define crt_scalbn(x, y) __builtin_scalbn((x), (y))
+#define crt_scalbnf(x, y) __builtin_scalbnf((x), (y))
+#define crt_scalbnl(x, y) __builtin_scalbnl((x), (y))
+
#endif /* INT_MATH_H */
Modified: compiler-rt/trunk/lib/muldc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/muldc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/muldc3.c (original)
+++ compiler-rt/trunk/lib/muldc3.c Wed Nov 16 01:33:06 2011
@@ -14,7 +14,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the product of a + ib and c + id */
@@ -33,41 +32,41 @@
int __recalc = 0;
if (crt_isinf(__a) || crt_isinf(__b))
{
- __a = copysign(crt_isinf(__a) ? 1 : 0, __a);
- __b = copysign(crt_isinf(__b) ? 1 : 0, __b);
+ __a = crt_copysign(crt_isinf(__a) ? 1 : 0, __a);
+ __b = crt_copysign(crt_isinf(__b) ? 1 : 0, __b);
if (crt_isnan(__c))
- __c = copysign(0, __c);
+ __c = crt_copysign(0, __c);
if (crt_isnan(__d))
- __d = copysign(0, __d);
+ __d = crt_copysign(0, __d);
__recalc = 1;
}
if (crt_isinf(__c) || crt_isinf(__d))
{
- __c = copysign(crt_isinf(__c) ? 1 : 0, __c);
- __d = copysign(crt_isinf(__d) ? 1 : 0, __d);
+ __c = crt_copysign(crt_isinf(__c) ? 1 : 0, __c);
+ __d = crt_copysign(crt_isinf(__d) ? 1 : 0, __d);
if (crt_isnan(__a))
- __a = copysign(0, __a);
+ __a = crt_copysign(0, __a);
if (crt_isnan(__b))
- __b = copysign(0, __b);
+ __b = crt_copysign(0, __b);
__recalc = 1;
}
if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) ||
crt_isinf(__ad) || crt_isinf(__bc)))
{
if (crt_isnan(__a))
- __a = copysign(0, __a);
+ __a = crt_copysign(0, __a);
if (crt_isnan(__b))
- __b = copysign(0, __b);
+ __b = crt_copysign(0, __b);
if (crt_isnan(__c))
- __c = copysign(0, __c);
+ __c = crt_copysign(0, __c);
if (crt_isnan(__d))
- __d = copysign(0, __d);
+ __d = crt_copysign(0, __d);
__recalc = 1;
}
if (__recalc)
{
- __real__ z = INFINITY * (__a * __c - __b * __d);
- __imag__ z = INFINITY * (__a * __d + __b * __c);
+ __real__ z = CRT_INFINITY * (__a * __c - __b * __d);
+ __imag__ z = CRT_INFINITY * (__a * __d + __b * __c);
}
}
return z;
Modified: compiler-rt/trunk/lib/mulsc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/mulsc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/mulsc3.c (original)
+++ compiler-rt/trunk/lib/mulsc3.c Wed Nov 16 01:33:06 2011
@@ -14,7 +14,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the product of a + ib and c + id */
@@ -33,41 +32,41 @@
int __recalc = 0;
if (crt_isinf(__a) || crt_isinf(__b))
{
- __a = copysignf(crt_isinf(__a) ? 1 : 0, __a);
- __b = copysignf(crt_isinf(__b) ? 1 : 0, __b);
+ __a = crt_copysignf(crt_isinf(__a) ? 1 : 0, __a);
+ __b = crt_copysignf(crt_isinf(__b) ? 1 : 0, __b);
if (crt_isnan(__c))
- __c = copysignf(0, __c);
+ __c = crt_copysignf(0, __c);
if (crt_isnan(__d))
- __d = copysignf(0, __d);
+ __d = crt_copysignf(0, __d);
__recalc = 1;
}
if (crt_isinf(__c) || crt_isinf(__d))
{
- __c = copysignf(crt_isinf(__c) ? 1 : 0, __c);
- __d = copysignf(crt_isinf(__d) ? 1 : 0, __d);
+ __c = crt_copysignf(crt_isinf(__c) ? 1 : 0, __c);
+ __d = crt_copysignf(crt_isinf(__d) ? 1 : 0, __d);
if (crt_isnan(__a))
- __a = copysignf(0, __a);
+ __a = crt_copysignf(0, __a);
if (crt_isnan(__b))
- __b = copysignf(0, __b);
+ __b = crt_copysignf(0, __b);
__recalc = 1;
}
if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) ||
crt_isinf(__ad) || crt_isinf(__bc)))
{
if (crt_isnan(__a))
- __a = copysignf(0, __a);
+ __a = crt_copysignf(0, __a);
if (crt_isnan(__b))
- __b = copysignf(0, __b);
+ __b = crt_copysignf(0, __b);
if (crt_isnan(__c))
- __c = copysignf(0, __c);
+ __c = crt_copysignf(0, __c);
if (crt_isnan(__d))
- __d = copysignf(0, __d);
+ __d = crt_copysignf(0, __d);
__recalc = 1;
}
if (__recalc)
{
- __real__ z = INFINITY * (__a * __c - __b * __d);
- __imag__ z = INFINITY * (__a * __d + __b * __c);
+ __real__ z = CRT_INFINITY * (__a * __c - __b * __d);
+ __imag__ z = CRT_INFINITY * (__a * __d + __b * __c);
}
}
return z;
Modified: compiler-rt/trunk/lib/mulxc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/mulxc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/mulxc3.c (original)
+++ compiler-rt/trunk/lib/mulxc3.c Wed Nov 16 01:33:06 2011
@@ -16,7 +16,6 @@
#include "int_lib.h"
#include "int_math.h"
-#include <math.h>
/* Returns: the product of a + ib and c + id */
@@ -35,41 +34,41 @@
int __recalc = 0;
if (crt_isinf(__a) || crt_isinf(__b))
{
- __a = copysignl(crt_isinf(__a) ? 1 : 0, __a);
- __b = copysignl(crt_isinf(__b) ? 1 : 0, __b);
+ __a = crt_copysignl(crt_isinf(__a) ? 1 : 0, __a);
+ __b = crt_copysignl(crt_isinf(__b) ? 1 : 0, __b);
if (crt_isnan(__c))
- __c = copysignl(0, __c);
+ __c = crt_copysignl(0, __c);
if (crt_isnan(__d))
- __d = copysignl(0, __d);
+ __d = crt_copysignl(0, __d);
__recalc = 1;
}
if (crt_isinf(__c) || crt_isinf(__d))
{
- __c = copysignl(crt_isinf(__c) ? 1 : 0, __c);
- __d = copysignl(crt_isinf(__d) ? 1 : 0, __d);
+ __c = crt_copysignl(crt_isinf(__c) ? 1 : 0, __c);
+ __d = crt_copysignl(crt_isinf(__d) ? 1 : 0, __d);
if (crt_isnan(__a))
- __a = copysignl(0, __a);
+ __a = crt_copysignl(0, __a);
if (crt_isnan(__b))
- __b = copysignl(0, __b);
+ __b = crt_copysignl(0, __b);
__recalc = 1;
}
if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) ||
crt_isinf(__ad) || crt_isinf(__bc)))
{
if (crt_isnan(__a))
- __a = copysignl(0, __a);
+ __a = crt_copysignl(0, __a);
if (crt_isnan(__b))
- __b = copysignl(0, __b);
+ __b = crt_copysignl(0, __b);
if (crt_isnan(__c))
- __c = copysignl(0, __c);
+ __c = crt_copysignl(0, __c);
if (crt_isnan(__d))
- __d = copysignl(0, __d);
+ __d = crt_copysignl(0, __d);
__recalc = 1;
}
if (__recalc)
{
- __real__ z = INFINITY * (__a * __c - __b * __d);
- __imag__ z = INFINITY * (__a * __d + __b * __c);
+ __real__ z = CRT_INFINITY * (__a * __c - __b * __d);
+ __imag__ z = CRT_INFINITY * (__a * __d + __b * __c);
}
}
return z;
Modified: compiler-rt/trunk/lib/ppc/divtc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ppc/divtc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ppc/divtc3.c (original)
+++ compiler-rt/trunk/lib/ppc/divtc3.c Wed Nov 16 01:33:06 2011
@@ -4,14 +4,13 @@
#include "DD.h"
#include "../int_math.h"
-#include <math.h>
-#if !defined(INFINITY) && defined(HUGE_VAL)
-#define INFINITY HUGE_VAL
-#endif /* INFINITY */
+#if !defined(CRT_INFINITY) && defined(HUGE_VAL)
+#define CRT_INFINITY HUGE_VAL
+#endif /* CRT_INFINITY */
#define makeFinite(x) { \
- (x).s.hi = __builtin_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
+ (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
(x).s.lo = 0.0; \
}
@@ -27,16 +26,16 @@
DD dDD = { .ld = d };
int ilogbw = 0;
- const double logbw = logb(__builtin_fmax( __builtin_fabs(cDD.s.hi), __builtin_fabs(dDD.s.hi) ));
+ const double logbw = crt_logb(crt_fmax(crt_fabs(cDD.s.hi), crt_fabs(dDD.s.hi) ));
if (crt_isfinite(logbw))
{
ilogbw = (int)logbw;
- cDD.s.hi = scalbn(cDD.s.hi, -ilogbw);
- cDD.s.lo = scalbn(cDD.s.lo, -ilogbw);
- dDD.s.hi = scalbn(dDD.s.hi, -ilogbw);
- dDD.s.lo = scalbn(dDD.s.lo, -ilogbw);
+ cDD.s.hi = crt_scalbn(cDD.s.hi, -ilogbw);
+ cDD.s.lo = crt_scalbn(cDD.s.lo, -ilogbw);
+ dDD.s.hi = crt_scalbn(dDD.s.hi, -ilogbw);
+ dDD.s.lo = crt_scalbn(dDD.s.lo, -ilogbw);
}
const long double denom = __gcc_qadd(__gcc_qmul(cDD.ld, cDD.ld), __gcc_qmul(dDD.ld, dDD.ld));
@@ -46,10 +45,10 @@
DD real = { .ld = __gcc_qdiv(realNumerator, denom) };
DD imag = { .ld = __gcc_qdiv(imagNumerator, denom) };
- real.s.hi = scalbn(real.s.hi, -ilogbw);
- real.s.lo = scalbn(real.s.lo, -ilogbw);
- imag.s.hi = scalbn(imag.s.hi, -ilogbw);
- imag.s.lo = scalbn(imag.s.lo, -ilogbw);
+ real.s.hi = crt_scalbn(real.s.hi, -ilogbw);
+ real.s.lo = crt_scalbn(real.s.lo, -ilogbw);
+ imag.s.hi = crt_scalbn(imag.s.hi, -ilogbw);
+ imag.s.lo = crt_scalbn(imag.s.lo, -ilogbw);
if (crt_isnan(real.s.hi) && crt_isnan(imag.s.hi))
{
@@ -60,9 +59,9 @@
if ((rDD.s.hi == 0.0) && (!crt_isnan(aDD.s.hi) ||
!crt_isnan(bDD.s.hi)))
{
- real.s.hi = __builtin_copysign(INFINITY,cDD.s.hi) * aDD.s.hi;
+ real.s.hi = crt_copysign(CRT_INFINITY,cDD.s.hi) * aDD.s.hi;
real.s.lo = 0.0;
- imag.s.hi = __builtin_copysign(INFINITY,cDD.s.hi) * bDD.s.hi;
+ imag.s.hi = crt_copysign(CRT_INFINITY,cDD.s.hi) * bDD.s.hi;
imag.s.lo = 0.0;
}
@@ -71,9 +70,9 @@
{
makeFinite(aDD);
makeFinite(bDD);
- real.s.hi = INFINITY * (aDD.s.hi*cDD.s.hi + bDD.s.hi*dDD.s.hi);
+ real.s.hi = CRT_INFINITY * (aDD.s.hi*cDD.s.hi + bDD.s.hi*dDD.s.hi);
real.s.lo = 0.0;
- imag.s.hi = INFINITY * (bDD.s.hi*cDD.s.hi - aDD.s.hi*dDD.s.hi);
+ imag.s.hi = CRT_INFINITY * (bDD.s.hi*cDD.s.hi - aDD.s.hi*dDD.s.hi);
imag.s.lo = 0.0;
}
@@ -82,9 +81,9 @@
{
makeFinite(cDD);
makeFinite(dDD);
- real.s.hi = __builtin_copysign(0.0,(aDD.s.hi*cDD.s.hi + bDD.s.hi*dDD.s.hi));
+ real.s.hi = crt_copysign(0.0,(aDD.s.hi*cDD.s.hi + bDD.s.hi*dDD.s.hi));
real.s.lo = 0.0;
- imag.s.hi = __builtin_copysign(0.0,(bDD.s.hi*cDD.s.hi - aDD.s.hi*dDD.s.hi));
+ imag.s.hi = crt_copysign(0.0,(bDD.s.hi*cDD.s.hi - aDD.s.hi*dDD.s.hi));
imag.s.lo = 0.0;
}
}
Modified: compiler-rt/trunk/lib/ppc/fixtfdi.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ppc/fixtfdi.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ppc/fixtfdi.c (original)
+++ compiler-rt/trunk/lib/ppc/fixtfdi.c Wed Nov 16 01:33:06 2011
@@ -7,6 +7,7 @@
*/
#include "DD.h"
+#include "../int_math.h"
uint64_t __fixtfdi(long double input)
{
@@ -64,7 +65,7 @@
/* Edge cases handled here: */
/* |x| < 1, result is zero. */
- if (1.0 > __builtin_fabs(x.s.hi))
+ if (1.0 > crt_fabs(x.s.hi))
return INT64_C(0);
/* x very close to INT64_MIN, care must be taken to see which side we are on. */
Modified: compiler-rt/trunk/lib/ppc/multc3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ppc/multc3.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ppc/multc3.c (original)
+++ compiler-rt/trunk/lib/ppc/multc3.c Wed Nov 16 01:33:06 2011
@@ -4,20 +4,15 @@
#include "DD.h"
#include "../int_math.h"
-#include <math.h>
-
-#if !defined(INFINITY) && defined(HUGE_VAL)
-#define INFINITY HUGE_VAL
-#endif /* INFINITY */
#define makeFinite(x) { \
- (x).s.hi = __builtin_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
+ (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
(x).s.lo = 0.0; \
}
#define zeroNaN() { \
if (crt_isnan((x).s.hi)) { \
- (x).s.hi = __builtin_copysign(0.0, (x).s.hi); \
+ (x).s.hi = crt_copysign(0.0, (x).s.hi); \
(x).s.lo = 0.0; \
} \
}
@@ -84,9 +79,9 @@
if (recalc)
{
- real.s.hi = INFINITY * (aDD.s.hi*cDD.s.hi - bDD.s.hi*dDD.s.hi);
+ real.s.hi = CRT_INFINITY * (aDD.s.hi*cDD.s.hi - bDD.s.hi*dDD.s.hi);
real.s.lo = 0.0;
- imag.s.hi = INFINITY * (aDD.s.hi*dDD.s.hi + bDD.s.hi*cDD.s.hi);
+ imag.s.hi = CRT_INFINITY * (aDD.s.hi*dDD.s.hi + bDD.s.hi*cDD.s.hi);
imag.s.lo = 0.0;
}
}
Modified: compiler-rt/trunk/make/platform/clang_darwin_test_input.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin_test_input.c?rev=144786&r1=144785&r2=144786&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin_test_input.c (original)
+++ compiler-rt/trunk/make/platform/clang_darwin_test_input.c Wed Nov 16 01:33:06 2011
@@ -2,4 +2,5 @@
#include <limits.h>
#include <stdint.h>
-#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
More information about the llvm-commits
mailing list