summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake2
-rw-r--r--config.h.cmake1
-rw-r--r--lib/CMakeLists.txt34
-rw-r--r--lib/apple_versioning.c6
-rw-r--r--lib/ashldi3.c8
-rw-r--r--lib/ashlti3.c8
-rw-r--r--lib/ashrdi3.c10
-rw-r--r--lib/ashrti3.c12
-rw-r--r--lib/clzdi2.c4
-rw-r--r--lib/clzti2.c2
-rw-r--r--lib/cmpdi2.c8
-rw-r--r--lib/ctzdi2.c4
-rw-r--r--lib/ffsdi2.c8
-rw-r--r--lib/ffsti2.c2
-rw-r--r--lib/fixdfdi.c8
-rw-r--r--lib/fixunsdfdi.c8
-rw-r--r--lib/fixunsdfsi.c8
-rw-r--r--lib/fixunsxfdi.c4
-rw-r--r--lib/fixunsxfsi.c8
-rw-r--r--lib/fixxfdi.c6
-rw-r--r--lib/fixxfti.c2
-rw-r--r--lib/floatdixf.c6
-rw-r--r--lib/floatundixf.c2
-rw-r--r--lib/int_lib.h8
-rw-r--r--lib/lshrdi3.c8
-rw-r--r--lib/lshrti3.c10
-rw-r--r--lib/muldi3.c24
-rw-r--r--lib/multi3.c24
-rw-r--r--lib/paritydi2.c2
-rw-r--r--lib/ppc/DD.h6
-rw-r--r--lib/ppc/divtc3.c54
-rw-r--r--lib/ppc/fixtfdi.c70
-rw-r--r--lib/ppc/fixunstfdi.c38
-rw-r--r--lib/ppc/floatditf.c31
-rw-r--r--lib/ppc/floatunditf.c32
-rw-r--r--lib/ppc/gcc_qadd.c40
-rw-r--r--lib/ppc/gcc_qdiv.c30
-rw-r--r--lib/ppc/gcc_qmul.c32
-rw-r--r--lib/ppc/gcc_qsub.c40
-rw-r--r--lib/ppc/multc3.c26
-rw-r--r--lib/subvti3.c2
-rw-r--r--lib/ucmpdi2.c8
-rw-r--r--lib/udivmoddi4.c136
-rw-r--r--lib/udivmodti4.c140
-rw-r--r--test/CMakeLists.txt110
-rw-r--r--test/Unit/CMakeLists.txt103
47 files changed, 603 insertions, 546 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a1bda82f..4ecba0770 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
# See docs/CMake.html for instructions about how to build Compiler-RT with CMake.
-PROJECT( CompilerRT )
+PROJECT( CompilerRT C )
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
set(PACKAGE_NAME compiler-rt)
@@ -29,11 +29,19 @@ install(DIRECTORY include
PATTERN "*.in" EXCLUDE
)
+SET( Achitectures
+ i386 ppc x86_64
+ )
+
+SET( Configurations
+ Debug Release Profile
+ )
+
# BlocksRuntime - some random cruft that got thrown in at the last minute, ignoring for now.
# ADD_SUBDIRECTORY( BlocksRuntime )
ADD_SUBDIRECTORY( lib )
# Tests are being ignored for until the very basics are working.
-# INCLUDE( MacroAddCheckTest )
-# ADD_SUBDIRECTORY( test )
+#INCLUDE( MacroAddCheckTest )
+#ADD_SUBDIRECTORY( test )
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
index ff3fbd0ed..4c570ab68 100644
--- a/cmake/Modules/DefineCompilerFlags.cmake
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -1,4 +1,4 @@
# Define compiler flags
#ADD_DEFINITIONS( -Wall -W -Werror -pedantic )
-ADD_DEFINITIONS( -std=gnu99 -Wall -Wextra -W -pedantic -Wno-unused-parameter )
+ADD_DEFINITIONS( -std=c99 -Wall -Wextra -W -pedantic -Wno-unused-parameter )
diff --git a/config.h.cmake b/config.h.cmake
index 4f640dbcd..ac72ee2d8 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1 +1,2 @@
#cmakedefine HAVE_SYS_BYTEORDER_H ${HAVE_SYS_BYTEORDER}
+#cmakedefine __Apple__ ${CMAKE_HOST_APPLE}
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index fa30cf628..40d05a9c7 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -6,6 +6,7 @@
#)
# Generic functions needed for each architecture
+# libcompiler_rt.Generic.a libcompiler_rt.Optimized.a
SET( SRCS
absvdi2.c cmpdi2.c fixdfdi.c floatdidf.c moddi3.c negvti2.c ucmpdi2.c
@@ -25,6 +26,25 @@ SET( SRCS
clzti2.c ffsti2.c fixxfti.c lshrti3.c negvsi2.c trampoline_setup.c
)
+# Generic
+SET( Common_SRCS
+ absvdi2.c absvsi2.c addvdi3.c addvsi3.c ashldi3.c ashrdi3.c
+ clear_cache.c clzdi2.c clzsi2.c cmpdi2.c ctzdi2.c ctzsi2.c
+ divdc3.c divdi3.c divsc3.c enable_execute_stack.c ffsdi2.c
+ fixdfdi.c fixsfdi.c fixunsdfdi.c fixunsdfsi.c fixunssfdi.c
+ fixunssfsi.c floatdidf.c floatdisf.c floatundidf.c floatundisf.c
+ gcc_personality_v0.c lshrdi3.c moddi3.c muldc3.c muldi3.c
+ mulsc3.c mulvdi3.c mulvsi3.c negdi2.c negvdi2.c negvsi2.c
+ paritydi2.c paritysi2.c popcountdi2.c popcountsi2.c powidf2.c
+ powisf2.c subvdi3.c subvsi3.c ucmpdi2.c udivdi3.c
+ udivmoddi4.c umoddi3.c apple_versioning.c eprintf.c
+ )
+
+SET( i386_Functions
+ divxc3.c fixunsxfdi.c fixunsxfsi.c fixxfdi.c
+ floatdixf.c floatundixf.c mulxc3.c powixf2.c
+ )
+
# Optimized functions for each architecture
# Commenting out for the min until the basics are working first.
@@ -32,6 +52,14 @@ SET( SRCS
# ADD_SUBDIRECTORY( x86_64 )
# ADD_SUBDIRECTORY( i386 )
-# Creates a shared lib .so
-ADD_LIBRARY( ${PROJECT_NAME} SHARED ${SRCS} )
-#ADD_LIBRARY( ${PROJECT_NAME} STATIC ${SRCS} )
+#FOREACH( LOOP_VAR ${Achitectures} )
+# See ARCHIVE_OUTPUT_DIRECTORY docs.
+#${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LOOP_VAR}
+#ENDFOREACH
+
+ADD_LIBRARY( ${PROJECT_NAME}-Common STATIC ${Common_SRCS} )
+#ADD_LIBRARY( ${PROJECT_NAME}-i386 STATIC ${i386_Functions} )
+
+# [[debug|optimized|general]
+#TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PROJECT_NAME}-Common optimized ${PROJECT_NAME}-i386 )
+
diff --git a/lib/apple_versioning.c b/lib/apple_versioning.c
index 4db098a4e..9c6dd5fa7 100644
--- a/lib/apple_versioning.c
+++ b/lib/apple_versioning.c
@@ -25,12 +25,13 @@
__attribute__((visibility("default"))) const char sym##_tmp4 = 0; \
extern const char sym##_tmp5 __asm("$ld$hide$os10.5$_" #sym ); \
__attribute__((visibility("default"))) const char sym##_tmp5 = 0;
- #endif
+ #endif /* __ppc__ */
/* Symbols in libSystem.dylib in 10.6 and later,
* but are in libgcc_s.dylib in earlier versions
*/
+
NOT_HERE_BEFORE_10_6(__absvdi2)
NOT_HERE_BEFORE_10_6(__absvsi2)
NOT_HERE_BEFORE_10_6(__absvti2)
@@ -138,8 +139,7 @@ NOT_HERE_BEFORE_10_6(__gcc_qdiv)
NOT_HERE_BEFORE_10_6(__gcc_qmul)
NOT_HERE_BEFORE_10_6(__gcc_qsub)
NOT_HERE_BEFORE_10_6(__trampoline_setup)
-#endif
+#endif /* __ppc__ */
#endif /* __APPLE__*/
-
diff --git a/lib/ashldi3.c b/lib/ashldi3.c
index c818ee71a..993f71ca9 100644
--- a/lib/ashldi3.c
+++ b/lib/ashldi3.c
@@ -27,15 +27,15 @@ __ashldi3(di_int a, si_int b)
input.all = a;
if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
{
- result.low = 0;
- result.high = input.low << (b - bits_in_word);
+ result.s.low = 0;
+ result.s.high = input.s.low << (b - bits_in_word);
}
else /* 0 <= b < bits_in_word */
{
if (b == 0)
return a;
- result.low = input.low << b;
- result.high = (input.high << b) | (input.low >> (bits_in_word - b));
+ result.s.low = input.s.low << b;
+ result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_word - b));
}
return result.all;
}
diff --git a/lib/ashlti3.c b/lib/ashlti3.c
index c1ab37163..317de6655 100644
--- a/lib/ashlti3.c
+++ b/lib/ashlti3.c
@@ -29,15 +29,15 @@ __ashlti3(ti_int a, si_int b)
input.all = a;
if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
{
- result.low = 0;
- result.high = input.low << (b - bits_in_dword);
+ result.s.low = 0;
+ result.s.high = input.s.low << (b - bits_in_dword);
}
else /* 0 <= b < bits_in_dword */
{
if (b == 0)
return a;
- result.low = input.low << b;
- result.high = (input.high << b) | (input.low >> (bits_in_dword - b));
+ result.s.low = input.s.low << b;
+ result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_dword - b));
}
return result.all;
}
diff --git a/lib/ashrdi3.c b/lib/ashrdi3.c
index a8125a3c7..8e27a11a7 100644
--- a/lib/ashrdi3.c
+++ b/lib/ashrdi3.c
@@ -27,16 +27,16 @@ __ashrdi3(di_int a, si_int b)
input.all = a;
if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
{
- /* result.high = input.high < 0 ? -1 : 0 */
- result.high = input.high >> (bits_in_word - 1);
- result.low = input.high >> (b - bits_in_word);
+ /* result.s.high = input.s.high < 0 ? -1 : 0 */
+ result.s.high = input.s.high >> (bits_in_word - 1);
+ result.s.low = input.s.high >> (b - bits_in_word);
}
else /* 0 <= b < bits_in_word */
{
if (b == 0)
return a;
- result.high = input.high >> b;
- result.low = (input.high << (bits_in_word - b)) | (input.low >> b);
+ result.s.high = input.s.high >> b;
+ result.s.low = (input.s.high << (bits_in_word - b)) | (input.s.low >> b);
}
return result.all;
}
diff --git a/lib/ashrti3.c b/lib/ashrti3.c
index 55645f78d..4eab2475c 100644
--- a/lib/ashrti3.c
+++ b/lib/ashrti3.c
@@ -29,18 +29,18 @@ __ashrti3(ti_int a, si_int b)
input.all = a;
if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
{
- /* result.high = input.high < 0 ? -1 : 0 */
- result.high = input.high >> (bits_in_dword - 1);
- result.low = input.high >> (b - bits_in_dword);
+ /* result.s.high = input.s.high < 0 ? -1 : 0 */
+ result.s.high = input.s.high >> (bits_in_dword - 1);
+ result.s.low = input.s.high >> (b - bits_in_dword);
}
else /* 0 <= b < bits_in_dword */
{
if (b == 0)
return a;
- result.high = input.high >> b;
- result.low = (input.high << (bits_in_dword - b)) | (input.low >> b);
+ result.s.high = input.s.high >> b;
+ result.s.low = (input.s.high << (bits_in_dword - b)) | (input.s.low >> b);
}
return result.all;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/clzdi2.c b/lib/clzdi2.c
index 34d43625a..ea953961d 100644
--- a/lib/clzdi2.c
+++ b/lib/clzdi2.c
@@ -23,7 +23,7 @@ __clzdi2(di_int a)
{
dwords x;
x.all = a;
- const si_int f = -(x.high == 0);
- return __builtin_clz((x.high & ~f) | (x.low & f)) +
+ const si_int f = -(x.s.high == 0);
+ return __builtin_clz((x.s.high & ~f) | (x.s.low & f)) +
(f & ((si_int)(sizeof(si_int) * CHAR_BIT)));
}
diff --git a/lib/clzti2.c b/lib/clzti2.c
index acdf479c4..eb05e2e23 100644
--- a/lib/clzti2.c
+++ b/lib/clzti2.c
@@ -30,4 +30,4 @@ __clzti2(ti_int a)
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/cmpdi2.c b/lib/cmpdi2.c
index ece48ae9f..0b8735244 100644
--- a/lib/cmpdi2.c
+++ b/lib/cmpdi2.c
@@ -26,13 +26,13 @@ __cmpdi2(di_int a, di_int b)
x.all = a;
dwords y;
y.all = b;
- if (x.high < y.high)
+ if (x.s.high < y.s.high)
return 0;
- if (x.high > y.high)
+ if (x.s.high > y.s.high)
return 2;
- if (x.low < y.low)
+ if (x.s.low < y.s.low)
return 0;
- if (x.low > y.low)
+ if (x.s.low > y.s.low)
return 2;
return 1;
}
diff --git a/lib/ctzdi2.c b/lib/ctzdi2.c
index 471c93b44..b49f2c713 100644
--- a/lib/ctzdi2.c
+++ b/lib/ctzdi2.c
@@ -23,7 +23,7 @@ __ctzdi2(di_int a)
{
dwords x;
x.all = a;
- const si_int f = -(x.low == 0);
- return __builtin_ctz((x.high & f) | (x.low & ~f)) +
+ const si_int f = -(x.s.low == 0);
+ return __builtin_ctz((x.s.high & f) | (x.s.low & ~f)) +
(f & ((si_int)(sizeof(si_int) * CHAR_BIT)));
}
diff --git a/lib/ffsdi2.c b/lib/ffsdi2.c
index 680fdb3ce..8c03d19af 100644
--- a/lib/ffsdi2.c
+++ b/lib/ffsdi2.c
@@ -23,11 +23,11 @@ __ffsdi2(di_int a)
{
dwords x;
x.all = a;
- if (x.low == 0)
+ if (x.s.low == 0)
{
- if (x.high == 0)
+ if (x.s.high == 0)
return 0;
- return __builtin_ctz(x.high) + (1 + sizeof(si_int) * CHAR_BIT);
+ return __builtin_ctz(x.s.high) + (1 + sizeof(si_int) * CHAR_BIT);
}
- return __builtin_ctz(x.low) + 1;
+ return __builtin_ctz(x.s.low) + 1;
}
diff --git a/lib/ffsti2.c b/lib/ffsti2.c
index 2ee1a8bd2..668b54296 100644
--- a/lib/ffsti2.c
+++ b/lib/ffsti2.c
@@ -34,4 +34,4 @@ __ffsti2(ti_int a)
return __builtin_ctzll(x.low) + 1;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/fixdfdi.c b/lib/fixdfdi.c
index fa5dd8993..3d3116c18 100644
--- a/lib/fixdfdi.c
+++ b/lib/fixdfdi.c
@@ -28,13 +28,13 @@ __fixdfdi(double a)
{
double_bits fb;
fb.f = a;
- int e = ((fb.u.high & 0x7FF00000) >> 20) - 1023;
+ int e = ((fb.u.s.high & 0x7FF00000) >> 20) - 1023;
if (e < 0)
return 0;
- di_int s = (si_int)(fb.u.high & 0x80000000) >> 31;
+ di_int s = (si_int)(fb.u.s.high & 0x80000000) >> 31;
dwords r;
- r.high = (fb.u.high & 0x000FFFFF) | 0x00100000;
- r.low = fb.u.low;
+ r.s.high = (fb.u.s.high & 0x000FFFFF) | 0x00100000;
+ r.s.low = fb.u.s.low;
if (e > 52)
r.all <<= (e - 52);
else
diff --git a/lib/fixunsdfdi.c b/lib/fixunsdfdi.c
index 4d5dcfebc..bdcee13e8 100644
--- a/lib/fixunsdfdi.c
+++ b/lib/fixunsdfdi.c
@@ -31,12 +31,12 @@ __fixunsdfdi(double a)
{
double_bits fb;
fb.f = a;
- int e = ((fb.u.high & 0x7FF00000) >> 20) - 1023;
- if (e < 0 || (fb.u.high & 0x80000000))
+ int e = ((fb.u.s.high & 0x7FF00000) >> 20) - 1023;
+ if (e < 0 || (fb.u.s.high & 0x80000000))
return 0;
udwords r;
- r.high = (fb.u.high & 0x000FFFFF) | 0x00100000;
- r.low = fb.u.low;
+ r.s.high = (fb.u.s.high & 0x000FFFFF) | 0x00100000;
+ r.s.low = fb.u.s.low;
if (e > 52)
r.all <<= (e - 52);
else
diff --git a/lib/fixunsdfsi.c b/lib/fixunsdfsi.c
index f9d2b6d86..a0cba79aa 100644
--- a/lib/fixunsdfsi.c
+++ b/lib/fixunsdfsi.c
@@ -31,12 +31,12 @@ __fixunsdfsi(double a)
{
double_bits fb;
fb.f = a;
- int e = ((fb.u.high & 0x7FF00000) >> 20) - 1023;
- if (e < 0 || (fb.u.high & 0x80000000))
+ int e = ((fb.u.s.high & 0x7FF00000) >> 20) - 1023;
+ if (e < 0 || (fb.u.s.high & 0x80000000))
return 0;
return (
0x80000000u |
- ((fb.u.high & 0x000FFFFF) << 11) |
- (fb.u.low >> 21)
+ ((fb.u.s.high & 0x000FFFFF) << 11) |
+ (fb.u.s.low >> 21)
) >> (31 - e);
}
diff --git a/lib/fixunsxfdi.c b/lib/fixunsxfdi.c
index e09f2d06d..872727bcd 100644
--- a/lib/fixunsxfdi.c
+++ b/lib/fixunsxfdi.c
@@ -35,8 +35,8 @@ __fixunsxfdi(long double a)
{
long_double_bits fb;
fb.f = a;
- int e = (fb.u.high.low & 0x00007FFF) - 16383;
- if (e < 0 || (fb.u.high.low & 0x00008000))
+ int e = (fb.u.high.s.low & 0x00007FFF) - 16383;
+ if (e < 0 || (fb.u.high.s.low & 0x00008000))
return 0;
return fb.u.low.all >> (63 - e);
}
diff --git a/lib/fixunsxfsi.c b/lib/fixunsxfsi.c
index a711a26e3..c9a607ace 100644
--- a/lib/fixunsxfsi.c
+++ b/lib/fixunsxfsi.c
@@ -35,10 +35,10 @@ __fixunsxfsi(long double a)
{
long_double_bits fb;
fb.f = a;
- int e = (fb.u.high.low & 0x00007FFF) - 16383;
- if (e < 0 || (fb.u.high.low & 0x00008000))
+ int e = (fb.u.high.s.low & 0x00007FFF) - 16383;
+ if (e < 0 || (fb.u.high.s.low & 0x00008000))
return 0;
- return fb.u.low.high >> (31 - e);
+ return fb.u.low.s.high >> (31 - e);
}
-#endif
+#endif /* !_ARCH_PPC */
diff --git a/lib/fixxfdi.c b/lib/fixxfdi.c
index 48bfc3ceb..de6f818b8 100644
--- a/lib/fixxfdi.c
+++ b/lib/fixxfdi.c
@@ -32,13 +32,13 @@ __fixxfdi(long double a)
{
long_double_bits fb;
fb.f = a;
- int e = (fb.u.high.low & 0x00007FFF) - 16383;
+ int e = (fb.u.high.s.low & 0x00007FFF) - 16383;
if (e < 0)
return 0;
- di_int s = -(si_int)((fb.u.high.low & 0x00008000) >> 15);
+ di_int s = -(si_int)((fb.u.high.s.low & 0x00008000) >> 15);
di_int r = fb.u.low.all;
r = (du_int)r >> (63 - e);
return (r ^ s) - s;
}
-#endif
+#endif /* !_ARCH_PPC */
diff --git a/lib/fixxfti.c b/lib/fixxfti.c
index 84406bd16..70d0e17b9 100644
--- a/lib/fixxfti.c
+++ b/lib/fixxfti.c
@@ -44,4 +44,4 @@ __fixxfti(long double a)
return (r ^ s) - s;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/floatdixf.c b/lib/floatdixf.c
index 6760ab32f..bfda367df 100644
--- a/lib/floatdixf.c
+++ b/lib/floatdixf.c
@@ -37,10 +37,10 @@ __floatdixf(di_int a)
int clz = __builtin_clzll(a);
int e = (N - 1) - clz ; /* exponent */
long_double_bits fb;
- fb.u.high.low = ((su_int)s & 0x00008000) | /* sign */
- (e + 16383); /* exponent */
+ fb.u.high.s.low = ((su_int)s & 0x00008000) | /* sign */
+ (e + 16383); /* exponent */
fb.u.low.all = a << clz; /* mantissa */
return fb.f;
}
-#endif
+#endif /* !_ARCH_PPC */
diff --git a/lib/floatundixf.c b/lib/floatundixf.c
index d87224f90..bc9582f76 100644
--- a/lib/floatundixf.c
+++ b/lib/floatundixf.c
@@ -34,7 +34,7 @@ __floatundixf(du_int a)
int clz = __builtin_clzll(a);
int e = (N - 1) - clz ; /* exponent */
long_double_bits fb;
- fb.u.high.low = (e + 16383); /* exponent */
+ fb.u.high.s.low = (e + 16383); /* exponent */
fb.u.low.all = a << clz; /* mantissa */
return fb.f;
}
diff --git a/lib/int_lib.h b/lib/int_lib.h
index 8f07ba2cb..2df744486 100644
--- a/lib/int_lib.h
+++ b/lib/int_lib.h
@@ -45,7 +45,7 @@ typedef union
si_int high;
su_int low;
#endif /* _YUGA_LITTLE_ENDIAN */
- };
+ }s;
} dwords;
typedef union
@@ -60,7 +60,7 @@ typedef union
su_int high;
su_int low;
#endif /* _YUGA_LITTLE_ENDIAN */
- };
+ }s;
} udwords;
#if __x86_64
@@ -80,7 +80,7 @@ typedef union
di_int high;
du_int low;
#endif /* _YUGA_LITTLE_ENDIAN */
- };
+ }s;
} twords;
typedef union
@@ -95,7 +95,7 @@ typedef union
du_int high;
du_int low;
#endif /* _YUGA_LITTLE_ENDIAN */
- };
+ }s;
} utwords;
#endif /* __x86_64 */
diff --git a/lib/lshrdi3.c b/lib/lshrdi3.c
index b3b31bf00..57484ee75 100644
--- a/lib/lshrdi3.c
+++ b/lib/lshrdi3.c
@@ -27,15 +27,15 @@ __lshrdi3(di_int a, si_int b)
input.all = a;
if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */
{
- result.high = 0;
- result.low = input.high >> (b - bits_in_word);
+ result.s.high = 0;
+ result.s.low = input.s.high >> (b - bits_in_word);
}
else /* 0 <= b < bits_in_word */
{
if (b == 0)
return a;
- result.high = input.high >> b;
- result.low = (input.high << (bits_in_word - b)) | (input.low >> b);
+ result.s.high = input.s.high >> b;
+ result.s.low = (input.s.high << (bits_in_word - b)) | (input.s.low >> b);
}
return result.all;
}
diff --git a/lib/lshrti3.c b/lib/lshrti3.c
index a2846875d..3272c9ca8 100644
--- a/lib/lshrti3.c
+++ b/lib/lshrti3.c
@@ -29,17 +29,17 @@ __lshrti3(ti_int a, si_int b)
input.all = a;
if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */
{
- result.high = 0;
- result.low = input.high >> (b - bits_in_dword);
+ result.s.high = 0;
+ result.s.low = input.s.high >> (b - bits_in_dword);
}
else /* 0 <= b < bits_in_dword */
{
if (b == 0)
return a;
- result.high = input.high >> b;
- result.low = (input.high << (bits_in_dword - b)) | (input.low >> b);
+ result.s.high = input.s.high >> b;
+ result.s.low = (input.s.high << (bits_in_dword - b)) | (input.s.low >> b);
}
return result.all;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/muldi3.c b/lib/muldi3.c
index 6ed5929da..38963b726 100644
--- a/lib/muldi3.c
+++ b/lib/muldi3.c
@@ -23,18 +23,18 @@ __muldsi3(su_int a, su_int b)
dwords r;
const int bits_in_word_2 = (int)(sizeof(si_int) * CHAR_BIT) / 2;
const su_int lower_mask = (su_int)~0 >> bits_in_word_2;
- r.low = (a & lower_mask) * (b & lower_mask);
- su_int t = r.low >> bits_in_word_2;
- r.low &= lower_mask;
+ r.s.low = (a & lower_mask) * (b & lower_mask);
+ su_int t = r.s.low >> bits_in_word_2;
+ r.s.low &= lower_mask;
t += (a >> bits_in_word_2) * (b & lower_mask);
- r.low += (t & lower_mask) << bits_in_word_2;
- r.high = t >> bits_in_word_2;
- t = r.low >> bits_in_word_2;
- r.low &= lower_mask;
+ r.s.low += (t & lower_mask) << bits_in_word_2;
+ r.s.high = t >> bits_in_word_2;
+ t = r.s.low >> bits_in_word_2;
+ r.s.low &= lower_mask;
t += (b >> bits_in_word_2) * (a & lower_mask);
- r.low += (t & lower_mask) << bits_in_word_2;
- r.high += t >> bits_in_word_2;
- r.high += (a >> bits_in_word_2) * (b >> bits_in_word_2);
+ r.s.low += (t & lower_mask) << bits_in_word_2;
+ r.s.high += t >> bits_in_word_2;
+ r.s.high += (a >> bits_in_word_2) * (b >> bits_in_word_2);
return r.all;
}
@@ -48,7 +48,7 @@ __muldi3(di_int a, di_int b)
dwords y;
y.all = b;
dwords r;
- r.all = __muldsi3(x.low, y.low);
- r.high += x.high * y.low + x.low * y.high;
+ r.all = __muldsi3(x.s.low, y.s.low);
+ r.s.high += x.s.high * y.s.low + x.s.low * y.s.high;
return r.all;
}
diff --git a/lib/multi3.c b/lib/multi3.c
index 849504913..9ba730e48 100644
--- a/lib/multi3.c
+++ b/lib/multi3.c
@@ -25,18 +25,18 @@ __mulddi3(du_int a, du_int b)
twords r;
const int bits_in_dword_2 = (int)(sizeof(di_int) * CHAR_BIT) / 2;
const du_int lower_mask = (du_int)~0 >> bits_in_dword_2;
- r.low = (a & lower_mask) * (b & lower_mask);
- du_int t = r.low >> bits_in_dword_2;
- r.low &= lower_mask;
+ r.s.low = (a & lower_mask) * (b & lower_mask);
+ du_int t = r.s.low >> bits_in_dword_2;
+ r.s.low &= lower_mask;
t += (a >> bits_in_dword_2) * (b & lower_mask);
- r.low += (t & lower_mask) << bits_in_dword_2;
- r.high = t >> bits_in_dword_2;
- t = r.low >> bits_in_dword_2;
- r.low &= lower_mask;
+ r.s.low += (t & lower_mask) << bits_in_dword_2;
+ r.s.high = t >> bits_in_dword_2;
+ t = r.s.low >> bits_in_dword_2;
+ r.s.low &= lower_mask;
t += (b >> bits_in_dword_2) * (a & lower_mask);
- r.low += (t & lower_mask) << bits_in_dword_2;
- r.high += t >> bits_in_dword_2;
- r.high += (a >> bits_in_dword_2) * (b >> bits_in_dword_2);
+ r.s.low += (t & lower_mask) << bits_in_dword_2;
+ r.s.high += t >> bits_in_dword_2;
+ r.s.high += (a >> bits_in_dword_2) * (b >> bits_in_dword_2);
return r.all;
}
@@ -51,8 +51,8 @@ __multi3(ti_int a, ti_int b)
y.all = b;
twords r;
r.all = __mulddi3(x.low, y.low);
- r.high += x.high * y.low + x.low * y.high;
+ r.s.high += x.high * y.low + x.low * y.high;
return r.all;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/paritydi2.c b/lib/paritydi2.c
index f77d4d728..90e5559bc 100644
--- a/lib/paritydi2.c
+++ b/lib/paritydi2.c
@@ -23,5 +23,5 @@ __paritydi2(di_int a)
{
dwords x;
x.all = a;
- return __paritysi2(x.high ^ x.low);
+ return __paritysi2(x.s.high ^ x.s.low);
}
diff --git a/lib/ppc/DD.h b/lib/ppc/DD.h
index 32acecd5f..9ecd1f50b 100644
--- a/lib/ppc/DD.h
+++ b/lib/ppc/DD.h
@@ -8,8 +8,8 @@ typedef union {
struct {
double hi;
double lo;
- };
-} DD;
+ }s;
+}DD;
typedef union {
double d;
@@ -43,4 +43,4 @@ different_sign(double x, double y)
return result;
}
-#endif // __DD_HEADER
+#endif /* __DD_HEADER */
diff --git a/lib/ppc/divtc3.c b/lib/ppc/divtc3.c
index dbb71ecc3..d41f62111 100644
--- a/lib/ppc/divtc3.c
+++ b/lib/ppc/divtc3.c
@@ -10,8 +10,8 @@
#endif /* INFINITY */
#define makeFinite(x) { \
- (x).hi = __builtin_copysign(isinf((x).hi) ? 1.0 : 0.0, (x).hi); \
- (x).lo = 0.0; \
+ (x).s.hi = __builtin_copysign(isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
+ (x).s.lo = 0.0; \
}
long double __gcc_qadd(long double, long double);
@@ -26,16 +26,16 @@ __divtc3(long double a, long double b, long double c, long double d)
DD dDD = { .ld = d };
int ilogbw = 0;
- const double logbw = logb(__builtin_fmax( __builtin_fabs(cDD.hi), __builtin_fabs(dDD.hi) ));
+ const double logbw = logb(__builtin_fmax( __builtin_fabs(cDD.s.hi), __builtin_fabs(dDD.s.hi) ));
if (isfinite(logbw))
{
ilogbw = (int)logbw;
- cDD.hi = scalbn(cDD.hi, -ilogbw);
- cDD.lo = scalbn(cDD.lo, -ilogbw);
- dDD.hi = scalbn(dDD.hi, -ilogbw);
- dDD.lo = scalbn(dDD.lo, -ilogbw);
+ 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);
}
const long double denom = __gcc_qadd(__gcc_qmul(cDD.ld, cDD.ld), __gcc_qmul(dDD.ld, dDD.ld));
@@ -45,43 +45,43 @@ __divtc3(long double a, long double b, long double c, long double d)
DD real = { .ld = __gcc_qdiv(realNumerator, denom) };
DD imag = { .ld = __gcc_qdiv(imagNumerator, denom) };
- real.hi = scalbn(real.hi, -ilogbw);
- real.lo = scalbn(real.lo, -ilogbw);
- imag.hi = scalbn(imag.hi, -ilogbw);
- imag.lo = scalbn(imag.lo, -ilogbw);
+ 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);
- if (isnan(real.hi) && isnan(imag.hi))
+ if (isnan(real.s.hi) && isnan(imag.s.hi))
{
DD aDD = { .ld = a };
DD bDD = { .ld = b };
DD rDD = { .ld = denom };
- if ((rDD.hi == 0.0) && (!isnan(aDD.hi) || !isnan(bDD.hi)))
+ if ((rDD.s.hi == 0.0) && (!isnan(aDD.s.hi) || !isnan(bDD.s.hi)))
{
- real.hi = __builtin_copysign(INFINITY,cDD.hi) * aDD.hi;
- real.lo = 0.0;
- imag.hi = __builtin_copysign(INFINITY,cDD.hi) * bDD.hi;
- imag.lo = 0.0;
+ real.s.hi = __builtin_copysign(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.lo = 0.0;
}
- else if ((isinf(aDD.hi) || isinf(bDD.hi)) && isfinite(cDD.hi) && isfinite(dDD.hi))
+ else if ((isinf(aDD.s.hi) || isinf(bDD.s.hi)) && isfinite(cDD.s.hi) && isfinite(dDD.s.hi))
{
makeFinite(aDD);
makeFinite(bDD);
- real.hi = INFINITY * (aDD.hi*cDD.hi + bDD.hi*dDD.hi);
- real.lo = 0.0;
- imag.hi = INFINITY * (bDD.hi*cDD.hi - aDD.hi*dDD.hi);
- imag.lo = 0.0;
+ real.s.hi = 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.lo = 0.0;
}
- else if ((isinf(cDD.hi) || isinf(dDD.hi)) && isfinite(aDD.hi) && isfinite(bDD.hi))
+ else if ((isinf(cDD.s.hi) || isinf(dDD.s.hi)) && isfinite(aDD.s.hi) && isfinite(bDD.s.hi))
{
makeFinite(cDD);
makeFinite(dDD);
- real.hi = __builtin_copysign(0.0,(aDD.hi*cDD.hi + bDD.hi*dDD.hi));
- real.lo = 0.0;
- imag.hi = __builtin_copysign(0.0,(bDD.hi*cDD.hi - aDD.hi*dDD.hi));
- imag.lo = 0.0;
+ real.s.hi = __builtin_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.lo = 0.0;
}
}
diff --git a/lib/ppc/fixtfdi.c b/lib/ppc/fixtfdi.c
index c95241701..fa113a037 100644
--- a/lib/ppc/fixtfdi.c
+++ b/lib/ppc/fixtfdi.c
@@ -1,8 +1,10 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// int64_t __fixunstfdi(long double x);
-// This file implements the PowerPC 128-bit double-double -> int64_t conversion
+/* int64_t __fixunstfdi(long double x);
+ * This file implements the PowerPC 128-bit double-double -> int64_t conversion
+ */
#include "DD.h"
#include <stdint.h>
@@ -10,42 +12,43 @@
uint64_t __fixtfdi(long double input)
{
const DD x = { .ld = input };
- const doublebits hibits = { .d = x.hi };
+ const doublebits hibits = { .d = x.s.hi };
const uint32_t absHighWord = (uint32_t)(hibits.x >> 32) & UINT32_C(0x7fffffff);
const uint32_t absHighWordMinusOne = absHighWord - UINT32_C(0x3ff00000);
- // If (1.0 - tiny) <= input < 0x1.0p63:
+ /* If (1.0 - tiny) <= input < 0x1.0p63: */
if (UINT32_C(0x03f00000) > absHighWordMinusOne)
{
- // Do an unsigned conversion of the absolute value, then restore the sign.
+ /* Do an unsigned conversion of the absolute value, then restore the sign. */
const int unbiasedHeadExponent = absHighWordMinusOne >> 20;
- int64_t result = hibits.x & INT64_C(0x000fffffffffffff); // mantissa(hi)
- result |= INT64_C(0x0010000000000000); // matissa(hi) with implicit bit
- result <<= 10; // mantissa(hi) with one zero preceeding bit.
+ int64_t result = hibits.x & INT64_C(0x000fffffffffffff); /* mantissa(hi) */
+ result |= INT64_C(0x0010000000000000); /* matissa(hi) with implicit bit */
+ result <<= 10; /* mantissa(hi) with one zero preceeding bit. */
const int64_t hiNegationMask = ((int64_t)(hibits.x)) >> 63;
- // If the tail is non-zero, we need to patch in the tail bits.
- if (0.0 != x.lo)
+ /* If the tail is non-zero, we need to patch in the tail bits. */
+ if (0.0 != x.s.lo)
{
- const doublebits lobits = { .d = x.lo };
+ const doublebits lobits = { .d = x.s.lo };
int64_t tailMantissa = lobits.x & INT64_C(0x000fffffffffffff);
tailMantissa |= INT64_C(0x0010000000000000);
- // At this point we have the mantissa of |tail|
- // We need to negate it if head and tail have different signs.
+ /* At this point we have the mantissa of |tail| */
+ /* We need to negate it if head and tail have different signs. */
const int64_t loNegationMask = ((int64_t)(lobits.x)) >> 63;
const int64_t negationMask = loNegationMask ^ hiNegationMask;
tailMantissa = (tailMantissa ^ negationMask) - negationMask;
- // Now we have the mantissa of tail as a signed 2s-complement integer
+ /* Now we have the mantissa of tail as a signed 2s-complement integer */
const int biasedTailExponent = (int)(lobits.x >> 52) & 0x7ff;
- // Shift the tail mantissa into the right position, accounting for the
- // bias of 10 that we shifted the head mantissa by.
+ /* Shift the tail mantissa into the right position, accounting for the
+ * bias of 10 that we shifted the head mantissa by.
+ */
tailMantissa >>= (unbiasedHeadExponent - (biasedTailExponent - (1023 - 10)));
result += tailMantissa;
@@ -53,36 +56,37 @@ uint64_t __fixtfdi(long double input)
result >>= (62 - unbiasedHeadExponent);
- // Restore the sign of the result and return
+ /* Restore the sign of the result and return */
result = (result ^ hiNegationMask) - hiNegationMask;
return result;
}
- // Edge cases handled here:
+ /* Edge cases handled here: */
- // |x| < 1, result is zero.
- if (1.0 > __builtin_fabs(x.hi))
+ /* |x| < 1, result is zero. */
+ if (1.0 > __builtin_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.
- if (x.hi == -0x1.0p63) {
+ /* x very close to INT64_MIN, care must be taken to see which side we are on. */
+ if (x.s.hi == -0x1.0p63) {
int64_t result = INT64_MIN;
- if (0.0 < x.lo)
+ if (0.0 < x.s.lo)
{
- // If the tail is positive, the correct result is something other than INT64_MIN.
- // we'll need to figure out what it is.
-
- const doublebits lobits = { .d = x.lo };
+ /* If the tail is positive, the correct result is something other than INT64_MIN.
+ * we'll need to figure out what it is.
+ */
+
+ const doublebits lobits = { .d = x.s.lo };
int64_t tailMantissa = lobits.x & INT64_C(0x000fffffffffffff);
tailMantissa |= INT64_C(0x0010000000000000);
- // Now we negate the tailMantissa
+ /* Now we negate the tailMantissa */
tailMantissa = (tailMantissa ^ INT64_C(-1)) + INT64_C(1);
- // And shift it by the appropriate amount
+ /* And shift it by the appropriate amount */
const int biasedTailExponent = (int)(lobits.x >> 52) & 0x7ff;
tailMantissa >>= 1075 - biasedTailExponent;
@@ -92,8 +96,8 @@ uint64_t __fixtfdi(long double input)
return result;
}
- // Signed overflows, infinities, and NaNs
- if (x.hi > 0.0)
+ /* Signed overflows, infinities, and NaNs */
+ if (x.s.hi > 0.0)
return INT64_MAX;
else
return INT64_MIN;
diff --git a/lib/ppc/fixunstfdi.c b/lib/ppc/fixunstfdi.c
index 35ce3a912..1fb524881 100644
--- a/lib/ppc/fixunstfdi.c
+++ b/lib/ppc/fixunstfdi.c
@@ -1,8 +1,9 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// uint64_t __fixunstfdi(long double x);
-// This file implements the PowerPC 128-bit double-double -> uint64_t conversion
+/* uint64_t __fixunstfdi(long double x); */
+/* This file implements the PowerPC 128-bit double-double -> uint64_t conversion */
#include "DD.h"
#include <stdint.h>
@@ -10,37 +11,38 @@
uint64_t __fixunstfdi(long double input)
{
const DD x = { .ld = input };
- const doublebits hibits = { .d = x.hi };
+ const doublebits hibits = { .d = x.s.hi };
const uint32_t highWordMinusOne = (uint32_t)(hibits.x >> 32) - UINT32_C(0x3ff00000);
- // If (1.0 - tiny) <= input < 0x1.0p64:
+ /* If (1.0 - tiny) <= input < 0x1.0p64: */
if (UINT32_C(0x04000000) > highWordMinusOne)
{
const int unbiasedHeadExponent = highWordMinusOne >> 20;
- uint64_t result = hibits.x & UINT64_C(0x000fffffffffffff); // mantissa(hi)
- result |= UINT64_C(0x0010000000000000); // matissa(hi) with implicit bit
- result <<= 11; // mantissa(hi) left aligned in the int64 field.
+ uint64_t result = hibits.x & UINT64_C(0x000fffffffffffff); /* mantissa(hi) */
+ result |= UINT64_C(0x0010000000000000); /* matissa(hi) with implicit bit */
+ result <<= 11; /* mantissa(hi) left aligned in the int64 field. */
- // If the tail is non-zero, we need to patch in the tail bits.
- if (0.0 != x.lo)
+ /* If the tail is non-zero, we need to patch in the tail bits. */
+ if (0.0 != x.s.lo)
{
- const doublebits lobits = { .d = x.lo };
+ const doublebits lobits = { .d = x.s.lo };
int64_t tailMantissa = lobits.x & INT64_C(0x000fffffffffffff);
tailMantissa |= INT64_C(0x0010000000000000);
- // At this point we have the mantissa of |tail|
+ /* At this point we have the mantissa of |tail| */
const int64_t negationMask = ((int64_t)(lobits.x)) >> 63;
tailMantissa = (tailMantissa ^ negationMask) - negationMask;
- // Now we have the mantissa of tail as a signed 2s-complement integer
+ /* Now we have the mantissa of tail as a signed 2s-complement integer */
const int biasedTailExponent = (int)(lobits.x >> 52) & 0x7ff;
- // Shift the tail mantissa into the right position, accounting for the
- // bias of 11 that we shifted the head mantissa by.
+ /* Shift the tail mantissa into the right position, accounting for the
+ * bias of 11 that we shifted the head mantissa by.
+ */
tailMantissa >>= (unbiasedHeadExponent - (biasedTailExponent - (1023 - 11)));
result += tailMantissa;
@@ -50,8 +52,8 @@ uint64_t __fixunstfdi(long double input)
return result;
}
- // Edge cases are handled here, with saturation.
- if (1.0 > x.hi)
+ /* Edge cases are handled here, with saturation. */
+ if (1.0 > x.s.hi)
return UINT64_C(0);
else
return UINT64_MAX;
diff --git a/lib/ppc/floatditf.c b/lib/ppc/floatditf.c
index 081dc8cbe..ed23dc84d 100644
--- a/lib/ppc/floatditf.c
+++ b/lib/ppc/floatditf.c
@@ -1,8 +1,9 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __floatditf(long long x);
-// This file implements the PowerPC long long -> long double conversion
+/* long double __floatditf(long long x); */
+/* This file implements the PowerPC long long -> long double conversion */
#include "DD.h"
#include <stdint.h>
@@ -13,21 +14,23 @@ long double __floatditf(int64_t a) {
static const double twop52 = 0x1.0p52;
doublebits low = { .d = twop52 };
- low.x |= a & UINT64_C(0x00000000ffffffff); // 0x1.0p52 + low 32 bits of a.
+ low.x |= a & UINT64_C(0x00000000ffffffff); /* 0x1.0p52 + low 32 bits of a. */
const double high_addend = (double)((int32_t)(a >> 32))*twop32 - twop52;
- // At this point, we have two double precision numbers
- // high_addend and low.d, and we wish to return their sum
- // as a canonicalized long double:
-
- // This implementation sets the inexact flag spuriously.
- // This could be avoided, but at some substantial cost.
-
+ /* At this point, we have two double precision numbers
+ * high_addend and low.d, and we wish to return their sum
+ * as a canonicalized long double:
+ */
+
+ /* This implementation sets the inexact flag spuriously.
+ * This could be avoided, but at some substantial cost.
+ */
+
DD result;
- result.hi = high_addend + low.d;
- result.lo = (high_addend - result.hi) + low.d;
+ result.s.hi = high_addend + low.d;
+ result.s.lo = (high_addend - result.s.hi) + low.d;
return result.ld;
diff --git a/lib/ppc/floatunditf.c b/lib/ppc/floatunditf.c
index 63f0b4467..20a3b71b3 100644
--- a/lib/ppc/floatunditf.c
+++ b/lib/ppc/floatunditf.c
@@ -1,15 +1,16 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __floatunditf(unsigned long long x);
-// This file implements the PowerPC unsigned long long -> long double conversion
+/* long double __floatunditf(unsigned long long x); */
+/* This file implements the PowerPC unsigned long long -> long double conversion */
#include "DD.h"
#include <stdint.h>
long double __floatunditf(uint64_t a) {
- // Begins with an exact copy of the code from __floatundidf
+ /* Begins with an exact copy of the code from __floatundidf */
static const double twop52 = 0x1.0p52;
static const double twop84 = 0x1.0p84;
@@ -18,22 +19,23 @@ long double __floatunditf(uint64_t a) {
doublebits high = { .d = twop84 };
doublebits low = { .d = twop52 };
- high.x |= a >> 32; // 0x1.0p84 + high 32 bits of a
- low.x |= a & UINT64_C(0x00000000ffffffff); // 0x1.0p52 + low 32 bits of a
+ high.x |= a >> 32; /* 0x1.0p84 + high 32 bits of a */
+ low.x |= a & UINT64_C(0x00000000ffffffff); /* 0x1.0p52 + low 32 bits of a */
const double high_addend = high.d - twop84_plus_twop52;
- // At this point, we have two double precision numbers
- // high_addend and low.d, and we wish to return their sum
- // as a canonicalized long double:
-
- // This implementation sets the inexact flag spuriously.
- // This could be avoided, but at some substantial cost.
+ /* At this point, we have two double precision numbers
+ * high_addend and low.d, and we wish to return their sum
+ * as a canonicalized long double:
+ */
+
+ /* This implementation sets the inexact flag spuriously. */
+ /* This could be avoided, but at some substantial cost. */
DD result;
- result.hi = high_addend + low.d;
- result.lo = (high_addend - result.hi) + low.d;
+ result.s.hi = high_addend + low.d;
+ result.s.lo = (high_addend - result.s.hi) + low.d;
return result.ld;
diff --git a/lib/ppc/gcc_qadd.c b/lib/ppc/gcc_qadd.c
index eb3fdd11e..c388c7e99 100644
--- a/lib/ppc/gcc_qadd.c
+++ b/lib/ppc/gcc_qadd.c
@@ -1,9 +1,11 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __gcc_qadd(long double x, long double y);
-// This file implements the PowerPC 128-bit double-double add operation.
-// This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+/* long double __gcc_qadd(long double x, long double y);
+ * This file implements the PowerPC 128-bit double-double add operation.
+ * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+ */
#include "DD.h"
@@ -13,33 +15,33 @@ long double __gcc_qadd(long double x, long double y)
DD dst = { .ld = x }, src = { .ld = y };
- register double A = dst.hi, a = dst.lo,
- B = src.hi, b = src.lo;
+ register double A = dst.s.hi, a = dst.s.lo,
+ B = src.s.hi, b = src.s.lo;
- // If both operands are zero:
+ /* If both operands are zero: */
if ((A == 0.0) && (B == 0.0)) {
- dst.hi = A + B;
- dst.lo = 0.0;
+ dst.s.hi = A + B;
+ dst.s.lo = 0.0;
return dst.ld;
}
- // If either operand is NaN or infinity:
+ /* If either operand is NaN or infinity: */
const doublebits abits = { .d = A };
const doublebits bbits = { .d = B };
if ((((uint32_t)(abits.x >> 32) & infinityHi) == infinityHi) ||
(((uint32_t)(bbits.x >> 32) & infinityHi) == infinityHi)) {
- dst.hi = A + B;
- dst.lo = 0.0;
+ dst.s.hi = A + B;
+ dst.s.lo = 0.0;
return dst.ld;
}
- // If the computation overflows:
- // This may be playing things a little bit fast and loose, but it will do for a start.
+ /* If the computation overflows: */
+ /* This may be playing things a little bit fast and loose, but it will do for a start. */
const double testForOverflow = A + (B + (a + b));
const doublebits testbits = { .d = testForOverflow };
if (((uint32_t)(testbits.x >> 32) & infinityHi) == infinityHi) {
- dst.hi = testForOverflow;
- dst.lo = 0.0;
+ dst.s.hi = testForOverflow;
+ dst.s.lo = 0.0;
return dst.ld;
}
@@ -67,8 +69,8 @@ long double __gcc_qadd(long double x, long double y)
else
w = T + Y;
- dst.hi = Y = W + w;
- dst.lo = (W - Y) + w;
+ dst.s.hi = Y = W + w;
+ dst.s.lo = (W - Y) + w;
return dst.ld;
}
diff --git a/lib/ppc/gcc_qdiv.c b/lib/ppc/gcc_qdiv.c
index 53e6c55ec..70aa00b64 100644
--- a/lib/ppc/gcc_qdiv.c
+++ b/lib/ppc/gcc_qdiv.c
@@ -1,9 +1,11 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __gcc_qdiv(long double x, long double y);
-// This file implements the PowerPC 128-bit double-double division operation.
-// This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+/* long double __gcc_qdiv(long double x, long double y);
+ * This file implements the PowerPC 128-bit double-double division operation.
+ * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+ */
#include "DD.h"
@@ -12,25 +14,25 @@ long double __gcc_qdiv(long double a, long double b)
static const uint32_t infinityHi = UINT32_C(0x7ff00000);
DD dst = { .ld = a }, src = { .ld = b };
- register double x = dst.hi, x1 = dst.lo,
- y = src.hi, y1 = src.lo;
+ register double x = dst.s.hi, x1 = dst.s.lo,
+ y = src.s.hi, y1 = src.s.lo;
double yHi, yLo, qHi, qLo;
double yq, tmp, q;
q = x / y;
- // Detect special cases
+ /* Detect special cases */
if (q == 0.0) {
- dst.hi = q;
- dst.lo = 0.0;
+ dst.s.hi = q;
+ dst.s.lo = 0.0;
return dst.ld;
}
const doublebits qBits = { .d = q };
if (((uint32_t)(qBits.x >> 32) & infinityHi) == infinityHi) {
- dst.hi = q;
- dst.lo = 0.0;
+ dst.s.hi = q;
+ dst.s.lo = 0.0;
return dst.ld;
}
@@ -46,8 +48,8 @@ long double __gcc_qdiv(long double a, long double b)
tmp = ((tmp + x1) - y1 * q) / y;
x = q + tmp;
- dst.lo = (q - x) + tmp;
- dst.hi = x;
+ dst.s.lo = (q - x) + tmp;
+ dst.s.hi = x;
return dst.ld;
}
diff --git a/lib/ppc/gcc_qmul.c b/lib/ppc/gcc_qmul.c
index 26d899ee8..fb4c5164c 100644
--- a/lib/ppc/gcc_qmul.c
+++ b/lib/ppc/gcc_qmul.c
@@ -1,9 +1,11 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __gcc_qmul(long double x, long double y);
-// This file implements the PowerPC 128-bit double-double multiply operation.
-// This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+/* long double __gcc_qmul(long double x, long double y);
+ * This file implements the PowerPC 128-bit double-double multiply operation.
+ * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+ */
#include "DD.h"
@@ -12,29 +14,29 @@ long double __gcc_qmul(long double x, long double y)
static const uint32_t infinityHi = UINT32_C(0x7ff00000);
DD dst = { .ld = x }, src = { .ld = y };
- register double A = dst.hi, a = dst.lo,
- B = src.hi, b = src.lo;
+ register double A = dst.s.hi, a = dst.s.lo,
+ B = src.s.hi, b = src.s.lo;
double aHi, aLo, bHi, bLo;
double ab, tmp, tau;
ab = A * B;
- // Detect special cases
+ /* Detect special cases */
if (ab == 0.0) {
- dst.hi = ab;
- dst.lo = 0.0;
+ dst.s.hi = ab;
+ dst.s.lo = 0.0;
return dst.ld;
}
const doublebits abBits = { .d = ab };
if (((uint32_t)(abBits.x >> 32) & infinityHi) == infinityHi) {
- dst.hi = ab;
- dst.lo = 0.0;
+ dst.s.hi = ab;
+ dst.s.lo = 0.0;
return dst.ld;
}
- // Generic cases handled here.
+ /* Generic cases handled here. */
aHi = high26bits(A);
bHi = high26bits(B);
aLo = A - aHi;
@@ -44,8 +46,8 @@ long double __gcc_qmul(long double x, long double y)
tmp += (A * b + a * B);
tau = ab + tmp;
- dst.lo = (ab - tau) + tmp;
- dst.hi = tau;
+ dst.s.lo = (ab - tau) + tmp;
+ dst.s.hi = tau;
return dst.ld;
}
diff --git a/lib/ppc/gcc_qsub.c b/lib/ppc/gcc_qsub.c
index f77deaa4f..4f1f7ac70 100644
--- a/lib/ppc/gcc_qsub.c
+++ b/lib/ppc/gcc_qsub.c
@@ -1,9 +1,11 @@
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+/* This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ */
-// long double __gcc_qsub(long double x, long double y);
-// This file implements the PowerPC 128-bit double-double add operation.
-// This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+/* long double __gcc_qsub(long double x, long double y);
+ * This file implements the PowerPC 128-bit double-double add operation.
+ * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
+ */
#include "DD.h"
@@ -13,33 +15,33 @@ long double __gcc_qsub(long double x, long double y)
DD dst = { .ld = x }, src = { .ld = y };
- register double A = dst.hi, a = dst.lo,
- B = -src.hi, b = -src.lo;
+ register double A = dst.s.hi, a = dst.s.lo,
+ B = -src.s.hi, b = -src.s.lo;
- // If both operands are zero:
+ /* If both operands are zero: */
if ((A == 0.0) && (B == 0.0)) {
- dst.hi = A + B;
- dst.lo = 0.0;
+ dst.s.hi = A + B;
+ dst.s.lo = 0.0;
return dst.ld;
}
- // If either operand is NaN or infinity:
+ /* If either operand is NaN or infinity: */
const doublebits abits = { .d = A };
const doublebits bbits = { .d = B };
if ((((uint32_t)(abits.x >> 32) & infinityHi) == infinityHi) ||
(((uint32_t)(bbits.x >> 32) & infinityHi) == infinityHi)) {
- dst.hi = A + B;
- dst.lo = 0.0;
+ dst.s.hi = A + B;
+ dst.s.lo = 0.0;
return dst.ld;
}
- // If the computation overflows:
- // This may be playing things a little bit fast and loose, but it will do for a start.
+ /* If the computation overflows: */
+ /* This may be playing things a little bit fast and loose, but it will do for a start. */
const double testForOverflow = A + (B + (a + b));
const doublebits testbits = { .d = testForOverflow };
if (((uint32_t)(testbits.x >> 32) & infinityHi) == infinityHi) {
- dst.hi = testForOverflow;
- dst.lo = 0.0;
+ dst.s.hi = testForOverflow;
+ dst.s.lo = 0.0;
return dst.ld;
}
@@ -67,8 +69,8 @@ long double __gcc_qsub(long double x, long double y)
else
w = T + Y;
- dst.hi = Y = W + w;
- dst.lo = (W - Y) + w;
+ dst.s.hi = Y = W + w;
+ dst.s.lo = (W - Y) + w;
return dst.ld;
}
diff --git a/lib/ppc/multc3.c b/lib/ppc/multc3.c
index 0944263b2..9d17a2c6b 100644
--- a/lib/ppc/multc3.c
+++ b/lib/ppc/multc3.c
@@ -10,14 +10,14 @@
#endif /* INFINITY */
#define makeFinite(x) { \
- (x).hi = __builtin_copysign(isinf((x).hi) ? 1.0 : 0.0, (x).hi); \
- (x).lo = 0.0; \
+ (x).s.hi = __builtin_copysign(isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \
+ (x).s.lo = 0.0; \
}
#define zeroNaN(x) { \
- if (isnan((x).hi)) { \
- (x).hi = __builtin_copysign(0.0, (x).hi); \
- (x).lo = 0.0; \
+ if (isnan((x).s.hi)) { \
+ (x).s.hi = __builtin_copysign(0.0, (x).s.hi); \
+ (x).s.lo = 0.0; \
} \
}
@@ -36,7 +36,7 @@ __multc3(long double a, long double b, long double c, long double d)
DD real = { .ld = __gcc_qsub(ac,bd) };
DD imag = { .ld = __gcc_qadd(ad,bc) };
- if (isnan(real.hi) && isnan(imag.hi))
+ if (isnan(real.s.hi) && isnan(imag.s.hi))
{
int recalc = 0;
@@ -45,7 +45,7 @@ __multc3(long double a, long double b, long double c, long double d)
DD cDD = { .ld = c };
DD dDD = { .ld = d };
- if (isinf(aDD.hi) || isinf(bDD.hi))
+ if (isinf(aDD.s.hi) || isinf(bDD.s.hi))
{
makeFinite(aDD);
makeFinite(bDD);
@@ -54,7 +54,7 @@ __multc3(long double a, long double b, long double c, long double d)
recalc = 1;
}
- if (isinf(cDD.hi) || isinf(dDD.hi))
+ if (isinf(cDD.s.hi) || isinf(dDD.s.hi))
{
makeFinite(cDD);
makeFinite(dDD);
@@ -70,7 +70,7 @@ __multc3(long double a, long double b, long double c, long double d)
DD adDD = { .ld = ad };
DD bcDD = { .ld = bc };
- if (isinf(acDD.hi) || isinf(bdDD.hi) || isinf(adDD.hi) || isinf(bcDD.hi))
+ if (isinf(acDD.s.hi) || isinf(bdDD.s.hi) || isinf(adDD.s.hi) || isinf(bcDD.s.hi))
{
zeroNaN(aDD);
zeroNaN(bDD);
@@ -82,10 +82,10 @@ __multc3(long double a, long double b, long double c, long double d)
if (recalc)
{
- real.hi = INFINITY * (aDD.hi*cDD.hi - bDD.hi*dDD.hi);
- real.lo = 0.0;
- imag.hi = INFINITY * (aDD.hi*dDD.hi + bDD.hi*cDD.hi);
- imag.lo = 0.0;
+ real.s.hi = 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.lo = 0.0;
}
}
diff --git a/lib/subvti3.c b/lib/subvti3.c
index a2f764688..244641044 100644
--- a/lib/subvti3.c
+++ b/lib/subvti3.c
@@ -38,4 +38,4 @@ __subvti3(ti_int a, ti_int b)
return s;
}
-#endif
+#endif /* __x86_64 */
diff --git a/lib/ucmpdi2.c b/lib/ucmpdi2.c
index 4f0382d82..d2900cae4 100644
--- a/lib/ucmpdi2.c
+++ b/lib/ucmpdi2.c
@@ -26,13 +26,13 @@ __ucmpdi2(du_int a, du_int b)
x.all = a;
udwords y;
y.all = b;
- if (x.high < y.high)
+ if (x.s.high < y.s.high)
return 0;
- if (x.high > y.high)
+ if (x.s.high > y.s.high)
return 2;
- if (x.low < y.low)
+ if (x.s.low < y.s.low)
return 0;
- if (x.low > y.low)
+ if (x.s.low > y.s.low)
return 2;
return 1;
}
diff --git a/lib/udivmoddi4.c b/lib/udivmoddi4.c
index 977a391e8..92742302c 100644
--- a/lib/udivmoddi4.c
+++ b/lib/udivmoddi4.c
@@ -33,41 +33,41 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
udwords r;
unsigned sr;
/* special cases, X is unknown, K != 0 */
- if (n.high == 0)
+ if (n.s.high == 0)
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* 0 X
* ---
* 0 X
*/
if (rem)
- *rem = n.low % d.low;
- return n.low / d.low;
+ *rem = n.s.low % d.s.low;
+ return n.s.low / d.s.low;
}
/* 0 X
* ---
* K X
*/
if (rem)
- *rem = n.low;
+ *rem = n.s.low;
return 0;
}
- /* n.high != 0 */
- if (d.low == 0)
+ /* n.s.high != 0 */
+ if (d.s.low == 0)
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* K X
* ---
* 0 0
*/
if (rem)
- *rem = n.high % d.low;
- return n.high / d.low;
+ *rem = n.s.high % d.s.low;
+ return n.s.high / d.s.low;
}
- /* d.high != 0 */
- if (n.low == 0)
+ /* d.s.high != 0 */
+ if (n.s.low == 0)
{
/* K 0
* ---
@@ -75,31 +75,31 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
*/
if (rem)
{
- r.high = n.high % d.high;
- r.low = 0;
+ r.s.high = n.s.high % d.s.high;
+ r.s.low = 0;
*rem = r.all;
}
- return n.high / d.high;
+ return n.s.high / d.s.high;
}
/* K K
* ---
* K 0
*/
- if ((d.high & (d.high - 1)) == 0) /* if d is a power of 2 */
+ if ((d.s.high & (d.s.high - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
{
- r.low = n.low;
- r.high = n.high & (d.high - 1);
+ r.s.low = n.s.low;
+ r.s.high = n.s.high & (d.s.high - 1);
*rem = r.all;
}
- return n.high >> __builtin_ctz(d.high);
+ return n.s.high >> __builtin_ctz(d.s.high);
}
/* K K
* ---
* K 0
*/
- sr = __builtin_clz(d.high) - __builtin_clz(n.high);
+ sr = __builtin_clz(d.s.high) - __builtin_clz(n.s.high);
/* 0 <= sr <= n_uword_bits - 2 or sr large */
if (sr > n_uword_bits - 2)
{
@@ -110,75 +110,75 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
++sr;
/* 1 <= sr <= n_uword_bits - 1 */
/* q.all = n.all << (n_udword_bits - sr); */
- q.low = 0;
- q.high = n.low << (n_uword_bits - sr);
+ q.s.low = 0;
+ q.s.high = n.s.low << (n_uword_bits - sr);
/* r.all = n.all >> sr; */
- r.high = n.high >> sr;
- r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ r.s.high = n.s.high >> sr;
+ r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr);
}
- else /* d.low != 0 */
+ else /* d.s.low != 0 */
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* K X
* ---
* 0 K
*/
- if ((d.low & (d.low - 1)) == 0) /* if d is a power of 2 */
+ if ((d.s.low & (d.s.low - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
- *rem = n.low & (d.low - 1);
- if (d.low == 1)
+ *rem = n.s.low & (d.s.low - 1);
+ if (d.s.low == 1)
return n.all;
- unsigned sr = __builtin_ctz(d.low);
- q.high = n.high >> sr;
- q.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ unsigned sr = __builtin_ctz(d.s.low);
+ q.s.high = n.s.high >> sr;
+ q.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr);
return q.all;
}
/* K X
* ---
*0 K
*/
- sr = 1 + n_uword_bits + __builtin_clz(d.low) - __builtin_clz(n.high);
+ sr = 1 + n_uword_bits + __builtin_clz(d.s.low) - __builtin_clz(n.s.high);
/* 2 <= sr <= n_udword_bits - 1
* q.all = n.all << (n_udword_bits - sr);
* r.all = n.all >> sr;
* if (sr == n_uword_bits)
* {
- * q.low = 0;
- * q.high = n.low;
- * r.high = 0;
- * r.low = n.high;
+ * q.s.low = 0;
+ * q.s.high = n.s.low;
+ * r.s.high = 0;
+ * r.s.low = n.s.high;
* }
* else if (sr < n_uword_bits) // 2 <= sr <= n_uword_bits - 1
* {
- * q.low = 0;
- * q.high = n.low << (n_uword_bits - sr);
- * r.high = n.high >> sr;
- * r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ * q.s.low = 0;
+ * q.s.high = n.s.low << (n_uword_bits - sr);
+ * r.s.high = n.s.high >> sr;
+ * r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr);
* }
* else // n_uword_bits + 1 <= sr <= n_udword_bits - 1
* {
- * q.low = n.low << (n_udword_bits - sr);
- * q.high = (n.high << (n_udword_bits - sr)) |
- * (n.low >> (sr - n_uword_bits));
- * r.high = 0;
- * r.low = n.high >> (sr - n_uword_bits);
+ * q.s.low = n.s.low << (n_udword_bits - sr);
+ * q.s.high = (n.s.high << (n_udword_bits - sr)) |
+ * (n.s.low >> (sr - n_uword_bits));
+ * r.s.high = 0;
+ * r.s.low = n.s.high >> (sr - n_uword_bits);
* }
*/
- q.low = (n.low << (n_udword_bits - sr)) &
+ q.s.low = (n.s.low << (n_udword_bits - sr)) &
((si_int)(n_uword_bits - sr) >> (n_uword_bits-1));
- q.high = ((n.low << ( n_uword_bits - sr)) &
+ q.s.high = ((n.s.low << ( n_uword_bits - sr)) &
((si_int)(sr - n_uword_bits - 1) >> (n_uword_bits-1))) |
- (((n.high << (n_udword_bits - sr)) |
- (n.low >> (sr - n_uword_bits))) &
+ (((n.s.high << (n_udword_bits - sr)) |
+ (n.s.low >> (sr - n_uword_bits))) &
((si_int)(n_uword_bits - sr) >> (n_uword_bits-1)));
- r.high = (n.high >> sr) &
+ r.s.high = (n.s.high >> sr) &
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1));
- r.low = ((n.high >> (sr - n_uword_bits)) &
+ r.s.low = ((n.s.high >> (sr - n_uword_bits)) &
((si_int)(n_uword_bits - sr - 1) >> (n_uword_bits-1))) |
- (((n.high << (n_uword_bits - sr)) |
- (n.low >> sr)) &
+ (((n.s.high << (n_uword_bits - sr)) |
+ (n.s.low >> sr)) &
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1)));
}
else
@@ -187,7 +187,7 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
* ---
* K K
*/
- sr = __builtin_clz(d.high) - __builtin_clz(n.high);
+ sr = __builtin_clz(d.s.high) - __builtin_clz(n.s.high);
/* 0 <= sr <= n_uword_bits - 1 or sr large */
if (sr > n_uword_bits - 1)
{
@@ -198,24 +198,24 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
++sr;
/* 1 <= sr <= n_uword_bits */
/* q.all = n.all << (n_udword_bits - sr); */
- q.low = 0;
- q.high = n.low << (n_uword_bits - sr);
+ q.s.low = 0;
+ q.s.high = n.s.low << (n_uword_bits - sr);
/* r.all = n.all >> sr;
* if (sr < n_uword_bits)
* {
- * r.high = n.high >> sr;
- * r.low = (n.high << (n_uword_bits - sr)) | (n.low >> sr);
+ * r.s.high = n.s.high >> sr;
+ * r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr);
* }
* else
* {
- * r.high = 0;
- * r.low = n.high;
+ * r.s.high = 0;
+ * r.s.low = n.s.high;
* }
*/
- r.high = (n.high >> sr) &
+ r.s.high = (n.s.high >> sr) &
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1));
- r.low = (n.high << (n_uword_bits - sr)) |
- ((n.low >> sr) &
+ r.s.low = (n.s.high << (n_uword_bits - sr)) |
+ ((n.s.low >> sr) &
((si_int)(sr - n_uword_bits) >> (n_uword_bits-1)));
}
}
@@ -229,10 +229,10 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
for (; sr > 0; --sr)
{
/* r:q = ((r:q) << 1) | carry */
- r.high = (r.high << 1) | (r.low >> (n_uword_bits - 1));
- r.low = (r.low << 1) | (q.high >> (n_uword_bits - 1));
- q.high = (q.high << 1) | (q.low >> (n_uword_bits - 1));
- q.low = (q.low << 1) | carry;
+ r.s.high = (r.s.high << 1) | (r.s.low >> (n_uword_bits - 1));
+ r.s.low = (r.s.low << 1) | (q.s.high >> (n_uword_bits - 1));
+ q.s.high = (q.s.high << 1) | (q.s.low >> (n_uword_bits - 1));
+ q.s.low = (q.s.low << 1) | carry;
/* carry = 0;
* if (r.all >= d.all)
* {
diff --git a/lib/udivmodti4.c b/lib/udivmodti4.c
index 12fa49cda..53b407256 100644
--- a/lib/udivmodti4.c
+++ b/lib/udivmodti4.c
@@ -35,41 +35,41 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
utwords r;
unsigned sr;
/* special cases, X is unknown, K != 0 */
- if (n.high == 0)
+ if (n.s.high == 0)
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* 0 X
* ---
* 0 X
*/
if (rem)
- *rem = n.low % d.low;
- return n.low / d.low;
+ *rem = n.s.low % d.s.low;
+ return n.s.low / d.s.low;
}
/* 0 X
* ---
* K X
*/
if (rem)
- *rem = n.low;
+ *rem = n.s.low;
return 0;
}
- /* n.high != 0 */
- if (d.low == 0)
+ /* n.s.high != 0 */
+ if (d.s.low == 0)
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* K X
* ---
* 0 0
*/
if (rem)
- *rem = n.high % d.low;
- return n.high / d.low;
+ *rem = n.s.high % d.s.low;
+ return n.s.high / d.s.low;
}
- /* d.high != 0 */
- if (n.low == 0)
+ /* d.s.high != 0 */
+ if (n.s.low == 0)
{
/* K 0
* ---
@@ -77,31 +77,31 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
*/
if (rem)
{
- r.high = n.high % d.high;
- r.low = 0;
+ r.s.high = n.s.high % d.s.high;
+ r.s.low = 0;
*rem = r.all;
}
- return n.high / d.high;
+ return n.s.high / d.s.high;
}
/* K K
* ---
* K 0
*/
- if ((d.high & (d.high - 1)) == 0) /* if d is a power of 2 */
+ if ((d.s.high & (d.s.high - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
{
- r.low = n.low;
- r.high = n.high & (d.high - 1);
+ r.s.low = n.s.low;
+ r.s.high = n.s.high & (d.s.high - 1);
*rem = r.all;
}
- return n.high >> __builtin_ctzll(d.high);
+ return n.s.high >> __builtin_ctzll(d.s.high);
}
/* K K
* ---
* K 0
*/
- sr = __builtin_clzll(d.high) - __builtin_clzll(n.high);
+ sr = __builtin_clzll(d.s.high) - __builtin_clzll(n.s.high);
/* 0 <= sr <= n_udword_bits - 2 or sr large */
if (sr > n_udword_bits - 2)
{
@@ -112,76 +112,76 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
++sr;
/* 1 <= sr <= n_udword_bits - 1 */
/* q.all = n.all << (n_utword_bits - sr); */
- q.low = 0;
- q.high = n.low << (n_udword_bits - sr);
+ q.s.low = 0;
+ q.s.high = n.s.low << (n_udword_bits - sr);
/* r.all = n.all >> sr; */
- r.high = n.high >> sr;
- r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ r.s.high = n.s.high >> sr;
+ r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr);
}
- else /* d.low != 0 */
+ else /* d.s.low != 0 */
{
- if (d.high == 0)
+ if (d.s.high == 0)
{
/* K X
* ---
* 0 K
*/
- if ((d.low & (d.low - 1)) == 0) /* if d is a power of 2 */
+ if ((d.s.low & (d.s.low - 1)) == 0) /* if d is a power of 2 */
{
if (rem)
- *rem = n.low & (d.low - 1);
- if (d.low == 1)
+ *rem = n.s.low & (d.s.low - 1);
+ if (d.s.low == 1)
return n.all;
- unsigned sr = __builtin_ctzll(d.low);
- q.high = n.high >> sr;
- q.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ unsigned sr = __builtin_ctzll(d.s.low);
+ q.s.high = n.s.high >> sr;
+ q.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr);
return q.all;
}
/* K X
* ---
* 0 K
*/
- sr = 1 + n_udword_bits + __builtin_clzll(d.low)
- - __builtin_clzll(n.high);
+ sr = 1 + n_udword_bits + __builtin_clzll(d.s.low)
+ - __builtin_clzll(n.s.high);
/* 2 <= sr <= n_utword_bits - 1
* q.all = n.all << (n_utword_bits - sr);
* r.all = n.all >> sr;
* if (sr == n_udword_bits)
* {
- * q.low = 0;
- * q.high = n.low;
- * r.high = 0;
- * r.low = n.high;
+ * q.s.low = 0;
+ * q.s.high = n.s.low;
+ * r.s.high = 0;
+ * r.s.low = n.s.high;
* }
* else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1
* {
- * q.low = 0;
- * q.high = n.low << (n_udword_bits - sr);
- * r.high = n.high >> sr;
- * r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ * q.s.low = 0;
+ * q.s.high = n.s.low << (n_udword_bits - sr);
+ * r.s.high = n.s.high >> sr;
+ * r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr);
* }
* else // n_udword_bits + 1 <= sr <= n_utword_bits - 1
* {
- * q.low = n.low << (n_utword_bits - sr);
- * q.high = (n.high << (n_utword_bits - sr)) |
- * (n.low >> (sr - n_udword_bits));
- * r.high = 0;
- * r.low = n.high >> (sr - n_udword_bits);
+ * q.s.low = n.s.low << (n_utword_bits - sr);
+ * q.s.high = (n.s.high << (n_utword_bits - sr)) |
+ * (n.s.low >> (sr - n_udword_bits));
+ * r.s.high = 0;
+ * r.s.low = n.s.high >> (sr - n_udword_bits);
* }
*/
- q.low = (n.low << (n_utword_bits - sr)) &
+ q.s.low = (n.s.low << (n_utword_bits - sr)) &
((di_int)(int)(n_udword_bits - sr) >> (n_udword_bits-1));
- q.high = ((n.low << ( n_udword_bits - sr)) &
+ q.s.high = ((n.s.low << ( n_udword_bits - sr)) &
((di_int)(int)(sr - n_udword_bits - 1) >> (n_udword_bits-1))) |
- (((n.high << (n_utword_bits - sr)) |
- (n.low >> (sr - n_udword_bits))) &
+ (((n.s.high << (n_utword_bits - sr)) |
+ (n.s.low >> (sr - n_udword_bits))) &
((di_int)(int)(n_udword_bits - sr) >> (n_udword_bits-1)));
- r.high = (n.high >> sr) &
+ r.s.high = (n.s.high >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1));
- r.low = ((n.high >> (sr - n_udword_bits)) &
+ r.s.low = ((n.s.high >> (sr - n_udword_bits)) &
((di_int)(int)(n_udword_bits - sr - 1) >> (n_udword_bits-1))) |
- (((n.high << (n_udword_bits - sr)) |
- (n.low >> sr)) &
+ (((n.s.high << (n_udword_bits - sr)) |
+ (n.s.low >> sr)) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1)));
}
else
@@ -190,7 +190,7 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* ---
* K K
*/
- sr = __builtin_clzll(d.high) - __builtin_clzll(n.high);
+ sr = __builtin_clzll(d.s.high) - __builtin_clzll(n.s.high);
/*0 <= sr <= n_udword_bits - 1 or sr large */
if (sr > n_udword_bits - 1)
{
@@ -201,24 +201,24 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
++sr;
/* 1 <= sr <= n_udword_bits */
/* q.all = n.all << (n_utword_bits - sr); */
- q.low = 0;
- q.high = n.low << (n_udword_bits - sr);
+ q.s.low = 0;
+ q.s.high = n.s.low << (n_udword_bits - sr);
/* r.all = n.all >> sr;
* if (sr < n_udword_bits)
* {
- * r.high = n.high >> sr;
- * r.low = (n.high << (n_udword_bits - sr)) | (n.low >> sr);
+ * r.s.high = n.s.high >> sr;
+ * r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr);
* }
* else
* {
- * r.high = 0;
- * r.low = n.high;
+ * r.s.high = 0;
+ * r.s.low = n.s.high;
* }
*/
- r.high = (n.high >> sr) &
+ r.s.high = (n.s.high >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1));
- r.low = (n.high << (n_udword_bits - sr)) |
- ((n.low >> sr) &
+ r.s.low = (n.s.high << (n_udword_bits - sr)) |
+ ((n.s.low >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1)));
}
}
@@ -232,10 +232,10 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
for (; sr > 0; --sr)
{
/* r:q = ((r:q) << 1) | carry */
- r.high = (r.high << 1) | (r.low >> (n_udword_bits - 1));
- r.low = (r.low << 1) | (q.high >> (n_udword_bits - 1));
- q.high = (q.high << 1) | (q.low >> (n_udword_bits - 1));
- q.low = (q.low << 1) | carry;
+ r.s.high = (r.s.high << 1) | (r.s.low >> (n_udword_bits - 1));
+ r.s.low = (r.s.low << 1) | (q.s.high >> (n_udword_bits - 1));
+ q.s.high = (q.s.high << 1) | (q.s.low >> (n_udword_bits - 1));
+ q.s.low = (q.s.low << 1) | carry;
/* carry = 0;
* if (r.all >= d.all)
* {
@@ -253,4 +253,4 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem)
return q.all;
}
-#endif
+#endif /* __x86_64 */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 68a7fd973..a7f31949e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-PROJECT( tests )
+PROJECT( tests C )
SET( CompilerRT_LIBRARY CompilerRT )
@@ -6,10 +6,114 @@ SET( CompilerRT_LIBRARY CompilerRT )
# add_library(${CompilerRT_LIBRARY} STATIC support.c cmdline.c)
TARGET_LINK_LIBRARIES( ${CompilerRT_LIBRARY} )
-SET( TEST_TARGET_LIBRARIES ${CompilerRT_LIBRARY} )
+SET( TEST_TARGET_LIBRARIES ${CompilerRT_LIBRARY}-Common )
# create tests
# MACRO_ADD_CHECK_TEST( foo foo.c ${TEST_TARGET_LIBRARIES} )
+
+# Create Unit/ tests
+
+MACRO_ADD_CHECK_TEST( ashldi3_test Unit/ashldi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( gcc_personality_test Unit/gcc_personality_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( udivmodti4_test Unit/udivmodti4_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( negvsi2_test Unit/negvsi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixdfdi_test Unit/fixdfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( mulvsi3_test Unit/mulvsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixdfti_test Unit/fixdfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( muldc3_test Unit/muldc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( popcountdi2_test Unit/popcountdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( negti2_test Unit/negti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divsc3_test Unit/divsc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( cmpti2_test Unit/cmpti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( trampoline_setup_test Unit/trampoline_setup_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( mulvti3_test Unit/mulvti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsxfdi_test Unit/fixunsxfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsxfti_test Unit/fixunsxfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( paritydi2_test Unit/paritydi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( negvti2_test Unit/negvti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divtc3_test Unit/divtc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ucmpti2_test Unit/ucmpti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( multc3_test Unit/multc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatdixf_test Unit/floatdixf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( popcountti2_test Unit/popcountti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( negdi2_test Unit/negdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatdidf_test Unit/floatdidf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunstfdi_test Unit/fixunstfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( shlti3_test Unit/ashlti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( enable_execute_stack_test Unit/enable_execute_stack_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatundixf_test Unit/floatundixf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( udivmoddi4_test Unit/udivmoddi4_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( paritysi2_test Unit/paritysi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatundidf_test Unit/floatundidf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divdc3_test Unit/divdc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatuntisf_test Unit/floatuntisf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ucmpdi2_test Unit/ucmpdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( powixf2_test Unit/powixf2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( mulsc3_test Unit/mulsc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( popcountsi2_test Unit/popcountsi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( cmpdi2_test Unit/cmpdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floattisf_test Unit/floattisf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( mulvdi3_test Unit/mulvdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunssfdi_test Unit/fixunssfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsdfsi_test Unit/fixunsdfsi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunssfti_test Unit/fixunssfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( parityti2_test Unit/parityti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( negvdi2_test Unit/negvdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( moddi3_test Unit/moddi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( clear_cache_test Unit/clear_cache_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsxfsi_test Unit/fixunsxfsi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( subvdi3_test Unit/subvdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( multi3_test Unit/multi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( addvdi3_test Unit/addvdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( clzti2_test Unit/clzti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( umoddi3_test Unit/umoddi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( absvsi2_test Unit/absvsi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ctzdi2_test Unit/ctzdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( powitf2_test Unit/powitf2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixsfdi_test Unit/fixsfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ffsti2_test Unit/ffsti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divdi3_test Unit/divdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixsfti_test Unit/fixsfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( absvti2_test Unit/absvti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ashrti3_test Unit/ashrti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( powisf2_test Unit/powisf2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( mulxc3_test Unit/mulxc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( lshrdi3_test Unit/lshrdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( udivdi3_test Unit/udivdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( clzsi2_test Unit/clzsi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( addvti3_test Unit/addvti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( udivsi3_test Unit/udivsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( clzdi2_test Unit/clzdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatuntidf_test Unit/floatuntidf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( umodti3_test Unit/umodti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divxc3_test Unit/divxc3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ctzti2_test Unit/ctzti2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatuntixf_test Unit/floatuntixf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( powidf2_test Unit/powidf2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floattidf_test Unit/floattidf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( modti3_test Unit/modti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunssfsi_test Unit/fixunssfsi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsdfdi_test Unit/fixunsdfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divsi3_test Unit/divsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floattixf_test Unit/floattixf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixunsdfti_test Unit/fixunsdfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( subvti3_test Unit/subvti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( muldi3_test Unit/muldi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ctzsi2_test Unit/ctzsi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( absvdi2_test Unit/absvdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ashrdi3_test Unit/ashrdi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( lshrti3_test Unit/lshrti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatdisf_test Unit/floatdisf_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( addvsi3_test Unit/addvsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( udivti3_test Unit/udivti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( umodsi3_test Unit/umodsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( subvsi3_test Unit/subvsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixxfdi_test Unit/fixxfdi_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( modsi3_test Unit/modsi3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( fixxfti_test Unit/fixxfti_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( ffsdi2_test Unit/ffsdi2_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( divti3_test Unit/divti3_test.c ${TEST_TARGET_LIBRARIES} )
+MACRO_ADD_CHECK_TEST( floatundisf_test Unit/floatundisf_test.c ${TEST_TARGET_LIBRARIES} )
+
#ADD_SUBDIRECTORY( timing )
-#ADD_SUBDIRECTORY( Unit )
diff --git a/test/Unit/CMakeLists.txt b/test/Unit/CMakeLists.txt
deleted file mode 100644
index c4a7c39b9..000000000
--- a/test/Unit/CMakeLists.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-
-# create tests
-MACRO_ADD_CHECK_TEST( ashldi3_test ashldi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( gcc_personality_test gcc_personality_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( udivmodti4_test udivmodti4_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( negvsi2_test negvsi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixdfdi_test fixdfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( mulvsi3_test mulvsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixdfti_test fixdfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( muldc3_test muldc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( popcountdi2_test popcountdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( negti2_test negti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divsc3_test divsc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( cmpti2_test cmpti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( trampoline_setup_test trampoline_setup_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( mulvti3_test mulvti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsxfdi_test fixunsxfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsxfti_test fixunsxfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( paritydi2_test paritydi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( negvti2_test negvti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divtc3_test divtc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ucmpti2_test ucmpti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( multc3_test multc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatdixf_test floatdixf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( popcountti2_test popcountti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( negdi2_test negdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatdidf_test floatdidf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunstfdi_test fixunstfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( shlti3_test ashlti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( enable_execute_stack_test enable_execute_stack_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatundixf_test floatundixf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( udivmoddi4_test udivmoddi4_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( paritysi2_test paritysi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatundidf_test floatundidf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divdc3_test divdc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatuntisf_test floatuntisf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ucmpdi2_test ucmpdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( powixf2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( mulsc3_test mulsc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( popcountsi2_test popcountsi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( cmpdi2_test cmpdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floattisf_test floattisf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( mulvdi3_test mulvdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunssfdi_test fixunssfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsdfsi_test fixunsdfsi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunssfti_test fixunssfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( parityti2_test parityti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( negvdi2_test negvdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( moddi3_test moddi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( clear_cache_test clear_cache_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsxfsi_test fixunsxfsi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( subvdi3_test subvdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( multi3_test multi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( addvdi3_test addvdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( clzti2_test clzti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( umoddi3_test umoddi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( absvsi2_test absvsi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ctzdi2_test ctzdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( powitf2_test powitf2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixsfdi_test fixsfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ffsti2_test ffsti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divdi3_test divdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixsfti_test fixsfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( absvti2_test absvti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ashrti3_test ashrti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( powisf2_test powisf2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( mulxc3_test mulxc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( lshrdi3_test lshrdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( udivdi3_test udivdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( clzsi2_test clzsi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( addvti3_test addvti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( udivsi3_test udivsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( clzdi2_test clzdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatuntidf_test floatuntidf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( umodti3_test umodti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divxc3_test divxc3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ctzti2_test ctzti2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatuntixf_test floatuntixf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( powidf2_test powidf2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floattidf_test floattidf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( modti3_test modti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunssfsi_test fixunssfsi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsdfdi_test fixunsdfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divsi3_test divsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floattixf_test floattixf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixunsdfti_test fixunsdfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( subvti3_test subvti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( muldi3_test muldi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ctzsi2_test ctzsi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( absvdi2_test absvdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ashrdi3_test ashrdi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( lshrti3_test lshrti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatdisf_test floatdisf_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( addvsi3_test addvsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( udivti3_test udivti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( umodsi3_test umodsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( subvsi3_test subvsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixxfdi_test fixxfdi_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( modsi3_test modsi3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( fixxfti_test fixxfti_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( ffsdi2_test ffsdi2_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( divti3_test divti3_test.c ${TEST_TARGET_LIBRARIES} )
-MACRO_ADD_CHECK_TEST( floatundisf_test floatundisf_test.c ${TEST_TARGET_LIBRARIES} )