diff options
Diffstat (limited to 'contrib/compiler-rt/lib')
147 files changed, 851 insertions, 897 deletions
diff --git a/contrib/compiler-rt/lib/abi.h b/contrib/compiler-rt/lib/abi.h deleted file mode 100644 index 2534317..0000000 --- a/contrib/compiler-rt/lib/abi.h +++ /dev/null @@ -1,23 +0,0 @@ -/* ===------ abi.h - configuration header for compiler-rt -----------------=== - * - * The LLVM Compiler Infrastructure - * - * This file is dual licensed under the MIT and the University of Illinois Open - * Source Licenses. See LICENSE.TXT for details. - * - * ===----------------------------------------------------------------------=== - * - * This file is a configuration header for compiler-rt. - * This file is not part of the interface of this library. - * - * ===----------------------------------------------------------------------=== - */ - -#if __ARM_EABI__ -# define ARM_EABI_FNALIAS(aeabi_name, name) \ - void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); -# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) -#else -# define ARM_EABI_FNALIAS(aeabi_name, name) -# define COMPILER_RT_ABI -#endif diff --git a/contrib/compiler-rt/lib/absvdi2.c b/contrib/compiler-rt/lib/absvdi2.c index 9c5d4a2..682c235 100644 --- a/contrib/compiler-rt/lib/absvdi2.c +++ b/contrib/compiler-rt/lib/absvdi2.c @@ -11,10 +11,8 @@ * *===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: absolute value */ diff --git a/contrib/compiler-rt/lib/absvsi2.c b/contrib/compiler-rt/lib/absvsi2.c index 80a1a78..4812af8 100644 --- a/contrib/compiler-rt/lib/absvsi2.c +++ b/contrib/compiler-rt/lib/absvsi2.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: absolute value */ diff --git a/contrib/compiler-rt/lib/absvti2.c b/contrib/compiler-rt/lib/absvti2.c index 9e73a26..8f2bddc 100644 --- a/contrib/compiler-rt/lib/absvti2.c +++ b/contrib/compiler-rt/lib/absvti2.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <stdlib.h> /* Returns: absolute value */ diff --git a/contrib/compiler-rt/lib/adddf3.c b/contrib/compiler-rt/lib/adddf3.c index 3cc997b..7eb40a1 100644 --- a/contrib/compiler-rt/lib/adddf3.c +++ b/contrib/compiler-rt/lib/adddf3.c @@ -12,8 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "abi.h" - #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/addsf3.c b/contrib/compiler-rt/lib/addsf3.c index 20610ef..e57270a 100644 --- a/contrib/compiler-rt/lib/addsf3.c +++ b/contrib/compiler-rt/lib/addsf3.c @@ -12,8 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "abi.h" - #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/addvdi3.c b/contrib/compiler-rt/lib/addvdi3.c index 51ad397..db45a27 100644 --- a/contrib/compiler-rt/lib/addvdi3.c +++ b/contrib/compiler-rt/lib/addvdi3.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: a + b */ diff --git a/contrib/compiler-rt/lib/addvsi3.c b/contrib/compiler-rt/lib/addvsi3.c index c18f7bd..81f515c 100644 --- a/contrib/compiler-rt/lib/addvsi3.c +++ b/contrib/compiler-rt/lib/addvsi3.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: a + b */ diff --git a/contrib/compiler-rt/lib/addvti3.c b/contrib/compiler-rt/lib/addvti3.c index ba220f5..9105c17 100644 --- a/contrib/compiler-rt/lib/addvti3.c +++ b/contrib/compiler-rt/lib/addvti3.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <stdlib.h> /* Returns: a + b */ diff --git a/contrib/compiler-rt/lib/apple_versioning.c b/contrib/compiler-rt/lib/apple_versioning.c deleted file mode 100644 index e838d72..0000000 --- a/contrib/compiler-rt/lib/apple_versioning.c +++ /dev/null @@ -1,291 +0,0 @@ -/* ===-- apple_versioning.c - Adds versioning symbols for ld ---------------=== - * - * The LLVM Compiler Infrastructure - * - * This file is dual licensed under the MIT and the University of Illinois Open - * Source Licenses. See LICENSE.TXT for details. - * - * ===----------------------------------------------------------------------=== - */ - - - -#if __APPLE__ - #if __arm__ - #define NOT_HERE_BEFORE_10_6(sym) - #elif __ppc__ - #define NOT_HERE_BEFORE_10_6(sym) \ - extern const char sym##_tmp3 __asm("$ld$hide$os10.3$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp3 = 0; \ - extern const char sym##_tmp4 __asm("$ld$hide$os10.4$_" #sym ); \ - __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; - #else - #define NOT_HERE_BEFORE_10_6(sym) \ - extern const char sym##_tmp4 __asm("$ld$hide$os10.4$_" #sym ); \ - __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 /* __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) -NOT_HERE_BEFORE_10_6(__addvdi3) -NOT_HERE_BEFORE_10_6(__addvsi3) -NOT_HERE_BEFORE_10_6(__addvti3) -NOT_HERE_BEFORE_10_6(__ashldi3) -NOT_HERE_BEFORE_10_6(__ashlti3) -NOT_HERE_BEFORE_10_6(__ashrdi3) -NOT_HERE_BEFORE_10_6(__ashrti3) -NOT_HERE_BEFORE_10_6(__clear_cache) -NOT_HERE_BEFORE_10_6(__clzdi2) -NOT_HERE_BEFORE_10_6(__clzsi2) -NOT_HERE_BEFORE_10_6(__clzti2) -NOT_HERE_BEFORE_10_6(__cmpdi2) -NOT_HERE_BEFORE_10_6(__cmpti2) -NOT_HERE_BEFORE_10_6(__ctzdi2) -NOT_HERE_BEFORE_10_6(__ctzsi2) -NOT_HERE_BEFORE_10_6(__ctzti2) -NOT_HERE_BEFORE_10_6(__divdc3) -NOT_HERE_BEFORE_10_6(__divdi3) -NOT_HERE_BEFORE_10_6(__divsc3) -NOT_HERE_BEFORE_10_6(__divtc3) -NOT_HERE_BEFORE_10_6(__divti3) -NOT_HERE_BEFORE_10_6(__divxc3) -NOT_HERE_BEFORE_10_6(__enable_execute_stack) -NOT_HERE_BEFORE_10_6(__ffsdi2) -NOT_HERE_BEFORE_10_6(__ffsti2) -NOT_HERE_BEFORE_10_6(__fixdfdi) -NOT_HERE_BEFORE_10_6(__fixdfti) -NOT_HERE_BEFORE_10_6(__fixsfdi) -NOT_HERE_BEFORE_10_6(__fixsfti) -NOT_HERE_BEFORE_10_6(__fixtfdi) -NOT_HERE_BEFORE_10_6(__fixunsdfdi) -NOT_HERE_BEFORE_10_6(__fixunsdfsi) -NOT_HERE_BEFORE_10_6(__fixunsdfti) -NOT_HERE_BEFORE_10_6(__fixunssfdi) -NOT_HERE_BEFORE_10_6(__fixunssfsi) -NOT_HERE_BEFORE_10_6(__fixunssfti) -NOT_HERE_BEFORE_10_6(__fixunstfdi) -NOT_HERE_BEFORE_10_6(__fixunsxfdi) -NOT_HERE_BEFORE_10_6(__fixunsxfsi) -NOT_HERE_BEFORE_10_6(__fixunsxfti) -NOT_HERE_BEFORE_10_6(__fixxfdi) -NOT_HERE_BEFORE_10_6(__fixxfti) -NOT_HERE_BEFORE_10_6(__floatdidf) -NOT_HERE_BEFORE_10_6(__floatdisf) -NOT_HERE_BEFORE_10_6(__floatditf) -NOT_HERE_BEFORE_10_6(__floatdixf) -NOT_HERE_BEFORE_10_6(__floattidf) -NOT_HERE_BEFORE_10_6(__floattisf) -NOT_HERE_BEFORE_10_6(__floattixf) -NOT_HERE_BEFORE_10_6(__floatundidf) -NOT_HERE_BEFORE_10_6(__floatundisf) -NOT_HERE_BEFORE_10_6(__floatunditf) -NOT_HERE_BEFORE_10_6(__floatundixf) -NOT_HERE_BEFORE_10_6(__floatuntidf) -NOT_HERE_BEFORE_10_6(__floatuntisf) -NOT_HERE_BEFORE_10_6(__floatuntixf) -NOT_HERE_BEFORE_10_6(__gcc_personality_v0) -NOT_HERE_BEFORE_10_6(__lshrdi3) -NOT_HERE_BEFORE_10_6(__lshrti3) -NOT_HERE_BEFORE_10_6(__moddi3) -NOT_HERE_BEFORE_10_6(__modti3) -NOT_HERE_BEFORE_10_6(__muldc3) -NOT_HERE_BEFORE_10_6(__muldi3) -NOT_HERE_BEFORE_10_6(__mulsc3) -NOT_HERE_BEFORE_10_6(__multc3) -NOT_HERE_BEFORE_10_6(__multi3) -NOT_HERE_BEFORE_10_6(__mulvdi3) -NOT_HERE_BEFORE_10_6(__mulvsi3) -NOT_HERE_BEFORE_10_6(__mulvti3) -NOT_HERE_BEFORE_10_6(__mulxc3) -NOT_HERE_BEFORE_10_6(__negdi2) -NOT_HERE_BEFORE_10_6(__negti2) -NOT_HERE_BEFORE_10_6(__negvdi2) -NOT_HERE_BEFORE_10_6(__negvsi2) -NOT_HERE_BEFORE_10_6(__negvti2) -NOT_HERE_BEFORE_10_6(__paritydi2) -NOT_HERE_BEFORE_10_6(__paritysi2) -NOT_HERE_BEFORE_10_6(__parityti2) -NOT_HERE_BEFORE_10_6(__popcountdi2) -NOT_HERE_BEFORE_10_6(__popcountsi2) -NOT_HERE_BEFORE_10_6(__popcountti2) -NOT_HERE_BEFORE_10_6(__powidf2) -NOT_HERE_BEFORE_10_6(__powisf2) -NOT_HERE_BEFORE_10_6(__powitf2) -NOT_HERE_BEFORE_10_6(__powixf2) -NOT_HERE_BEFORE_10_6(__subvdi3) -NOT_HERE_BEFORE_10_6(__subvsi3) -NOT_HERE_BEFORE_10_6(__subvti3) -NOT_HERE_BEFORE_10_6(__ucmpdi2) -NOT_HERE_BEFORE_10_6(__ucmpti2) -NOT_HERE_BEFORE_10_6(__udivdi3) -NOT_HERE_BEFORE_10_6(__udivmoddi4) -NOT_HERE_BEFORE_10_6(__udivmodti4) -NOT_HERE_BEFORE_10_6(__udivti3) -NOT_HERE_BEFORE_10_6(__umoddi3) -NOT_HERE_BEFORE_10_6(__umodti3) - - -#if __ppc__ -NOT_HERE_BEFORE_10_6(__gcc_qadd) -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 /* __ppc__ */ - -#if __arm__ && __DYNAMIC__ - #define NOT_HERE_UNTIL_AFTER_4_3(sym) \ - extern const char sym##_tmp1 __asm("$ld$hide$os3.0$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp1 = 0; \ - extern const char sym##_tmp2 __asm("$ld$hide$os3.1$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp2 = 0; \ - extern const char sym##_tmp3 __asm("$ld$hide$os3.2$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp3 = 0; \ - extern const char sym##_tmp4 __asm("$ld$hide$os4.0$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp4 = 0; \ - extern const char sym##_tmp5 __asm("$ld$hide$os4.1$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp5 = 0; \ - extern const char sym##_tmp6 __asm("$ld$hide$os4.2$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp6 = 0; \ - extern const char sym##_tmp7 __asm("$ld$hide$os4.3$_" #sym ); \ - __attribute__((visibility("default"))) const char sym##_tmp7 = 0; - -NOT_HERE_UNTIL_AFTER_4_3(__absvdi2) -NOT_HERE_UNTIL_AFTER_4_3(__absvsi2) -NOT_HERE_UNTIL_AFTER_4_3(__adddf3) -NOT_HERE_UNTIL_AFTER_4_3(__adddf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__addsf3) -NOT_HERE_UNTIL_AFTER_4_3(__addsf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__addvdi3) -NOT_HERE_UNTIL_AFTER_4_3(__addvsi3) -NOT_HERE_UNTIL_AFTER_4_3(__ashldi3) -NOT_HERE_UNTIL_AFTER_4_3(__ashrdi3) -NOT_HERE_UNTIL_AFTER_4_3(__bswapdi2) -NOT_HERE_UNTIL_AFTER_4_3(__bswapsi2) -NOT_HERE_UNTIL_AFTER_4_3(__clzdi2) -NOT_HERE_UNTIL_AFTER_4_3(__clzsi2) -NOT_HERE_UNTIL_AFTER_4_3(__cmpdi2) -NOT_HERE_UNTIL_AFTER_4_3(__ctzdi2) -NOT_HERE_UNTIL_AFTER_4_3(__ctzsi2) -NOT_HERE_UNTIL_AFTER_4_3(__divdc3) -NOT_HERE_UNTIL_AFTER_4_3(__divdf3) -NOT_HERE_UNTIL_AFTER_4_3(__divdf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__divdi3) -NOT_HERE_UNTIL_AFTER_4_3(__divsc3) -NOT_HERE_UNTIL_AFTER_4_3(__divsf3) -NOT_HERE_UNTIL_AFTER_4_3(__divsf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__divsi3) -NOT_HERE_UNTIL_AFTER_4_3(__eqdf2) -NOT_HERE_UNTIL_AFTER_4_3(__eqdf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__eqsf2) -NOT_HERE_UNTIL_AFTER_4_3(__eqsf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2) -NOT_HERE_UNTIL_AFTER_4_3(__extendsfdf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__ffsdi2) -NOT_HERE_UNTIL_AFTER_4_3(__fixdfdi) -NOT_HERE_UNTIL_AFTER_4_3(__fixdfsi) -NOT_HERE_UNTIL_AFTER_4_3(__fixdfsivfp) -NOT_HERE_UNTIL_AFTER_4_3(__fixsfdi) -NOT_HERE_UNTIL_AFTER_4_3(__fixsfsi) -NOT_HERE_UNTIL_AFTER_4_3(__fixsfsivfp) -NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfdi) -NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsi) -NOT_HERE_UNTIL_AFTER_4_3(__fixunsdfsivfp) -NOT_HERE_UNTIL_AFTER_4_3(__fixunssfdi) -NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsi) -NOT_HERE_UNTIL_AFTER_4_3(__fixunssfsivfp) -NOT_HERE_UNTIL_AFTER_4_3(__floatdidf) -NOT_HERE_UNTIL_AFTER_4_3(__floatdisf) -NOT_HERE_UNTIL_AFTER_4_3(__floatsidf) -NOT_HERE_UNTIL_AFTER_4_3(__floatsidfvfp) -NOT_HERE_UNTIL_AFTER_4_3(__floatsisf) -NOT_HERE_UNTIL_AFTER_4_3(__floatsisfvfp) -NOT_HERE_UNTIL_AFTER_4_3(__floatundidf) -NOT_HERE_UNTIL_AFTER_4_3(__floatundisf) -NOT_HERE_UNTIL_AFTER_4_3(__floatunsidf) -NOT_HERE_UNTIL_AFTER_4_3(__floatunsisf) -NOT_HERE_UNTIL_AFTER_4_3(__floatunssidfvfp) -NOT_HERE_UNTIL_AFTER_4_3(__floatunssisfvfp) -NOT_HERE_UNTIL_AFTER_4_3(__gedf2) -NOT_HERE_UNTIL_AFTER_4_3(__gedf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__gesf2) -NOT_HERE_UNTIL_AFTER_4_3(__gesf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__gtdf2) -NOT_HERE_UNTIL_AFTER_4_3(__gtdf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__gtsf2) -NOT_HERE_UNTIL_AFTER_4_3(__gtsf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__ledf2) -NOT_HERE_UNTIL_AFTER_4_3(__ledf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__lesf2) -NOT_HERE_UNTIL_AFTER_4_3(__lesf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__lshrdi3) -NOT_HERE_UNTIL_AFTER_4_3(__ltdf2) -NOT_HERE_UNTIL_AFTER_4_3(__ltdf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__ltsf2) -NOT_HERE_UNTIL_AFTER_4_3(__ltsf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__moddi3) -NOT_HERE_UNTIL_AFTER_4_3(__modsi3) -NOT_HERE_UNTIL_AFTER_4_3(__muldc3) -NOT_HERE_UNTIL_AFTER_4_3(__muldf3) -NOT_HERE_UNTIL_AFTER_4_3(__muldf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__muldi3) -NOT_HERE_UNTIL_AFTER_4_3(__mulsc3) -NOT_HERE_UNTIL_AFTER_4_3(__mulsf3) -NOT_HERE_UNTIL_AFTER_4_3(__mulsf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__mulvdi3) -NOT_HERE_UNTIL_AFTER_4_3(__mulvsi3) -NOT_HERE_UNTIL_AFTER_4_3(__nedf2) -NOT_HERE_UNTIL_AFTER_4_3(__nedf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__negdi2) -NOT_HERE_UNTIL_AFTER_4_3(__negvdi2) -NOT_HERE_UNTIL_AFTER_4_3(__negvsi2) -NOT_HERE_UNTIL_AFTER_4_3(__nesf2) -NOT_HERE_UNTIL_AFTER_4_3(__nesf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__paritydi2) -NOT_HERE_UNTIL_AFTER_4_3(__paritysi2) -NOT_HERE_UNTIL_AFTER_4_3(__popcountdi2) -NOT_HERE_UNTIL_AFTER_4_3(__popcountsi2) -NOT_HERE_UNTIL_AFTER_4_3(__powidf2) -NOT_HERE_UNTIL_AFTER_4_3(__powisf2) -NOT_HERE_UNTIL_AFTER_4_3(__subdf3) -NOT_HERE_UNTIL_AFTER_4_3(__subdf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__subsf3) -NOT_HERE_UNTIL_AFTER_4_3(__subsf3vfp) -NOT_HERE_UNTIL_AFTER_4_3(__subvdi3) -NOT_HERE_UNTIL_AFTER_4_3(__subvsi3) -NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2) -NOT_HERE_UNTIL_AFTER_4_3(__truncdfsf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__ucmpdi2) -NOT_HERE_UNTIL_AFTER_4_3(__udivdi3) -NOT_HERE_UNTIL_AFTER_4_3(__udivmoddi4) -NOT_HERE_UNTIL_AFTER_4_3(__udivsi3) -NOT_HERE_UNTIL_AFTER_4_3(__umoddi3) -NOT_HERE_UNTIL_AFTER_4_3(__umodsi3) -NOT_HERE_UNTIL_AFTER_4_3(__unorddf2) -NOT_HERE_UNTIL_AFTER_4_3(__unorddf2vfp) -NOT_HERE_UNTIL_AFTER_4_3(__unordsf2) -NOT_HERE_UNTIL_AFTER_4_3(__unordsf2vfp) - -NOT_HERE_UNTIL_AFTER_4_3(__divmodsi4) -NOT_HERE_UNTIL_AFTER_4_3(__udivmodsi4) -#endif // __arm__ && __DYNAMIC__ - - - - - -#else /* !__APPLE__ */ - -extern int avoid_empty_file; - -#endif /* !__APPLE__*/ diff --git a/contrib/compiler-rt/lib/arm/adddf3vfp.S b/contrib/compiler-rt/lib/arm/adddf3vfp.S index cced1e0..c90b0c2 100644 --- a/contrib/compiler-rt/lib/arm/adddf3vfp.S +++ b/contrib/compiler-rt/lib/arm/adddf3vfp.S @@ -15,10 +15,11 @@ // Adds two double precision floating point numbers using the Darwin // calling convention where double arguments are passsed in GPR pairs // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__adddf3vfp) - fmdrr d6, r0, r1 // move first param from r0/r1 pair into d6 - fmdrr d7, r2, r3 // move second param from r2/r3 pair into d7 - faddd d6, d6, d7 - fmrrd r0, r1, d6 // move result back to r0/r1 pair + vmov d6, r0, r1 // move first param from r0/r1 pair into d6 + vmov d7, r2, r3 // move second param from r2/r3 pair into d7 + vadd.f64 d6, d6, d7 + vmov r0, r1, d6 // move result back to r0/r1 pair bx lr diff --git a/contrib/compiler-rt/lib/arm/addsf3vfp.S b/contrib/compiler-rt/lib/arm/addsf3vfp.S index b747528..43653d5 100644 --- a/contrib/compiler-rt/lib/arm/addsf3vfp.S +++ b/contrib/compiler-rt/lib/arm/addsf3vfp.S @@ -15,10 +15,11 @@ // Adds two single precision floating point numbers using the Darwin // calling convention where single arguments are passsed in GPRs // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__addsf3vfp) - fmsr s14, r0 // move first param from r0 into float register - fmsr s15, r1 // move second param from r1 into float register - fadds s14, s14, s15 - fmrs r0, s14 // move result back to r0 + vmov s14, r0 // move first param from r0 into float register + vmov s15, r1 // move second param from r1 into float register + vadd.f32 s14, s14, s15 + vmov r0, s14 // move result back to r0 bx lr diff --git a/contrib/compiler-rt/lib/arm/divdf3vfp.S b/contrib/compiler-rt/lib/arm/divdf3vfp.S index 74ef0ea..52de67f 100644 --- a/contrib/compiler-rt/lib/arm/divdf3vfp.S +++ b/contrib/compiler-rt/lib/arm/divdf3vfp.S @@ -15,10 +15,11 @@ // Divides two double precision floating point numbers using the Darwin // calling convention where double arguments are passsed in GPR pairs // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__divdf3vfp) - fmdrr d6, r0, r1 // move first param from r0/r1 pair into d6 - fmdrr d7, r2, r3 // move second param from r2/r3 pair into d7 - fdivd d5, d6, d7 - fmrrd r0, r1, d5 // move result back to r0/r1 pair + vmov d6, r0, r1 // move first param from r0/r1 pair into d6 + vmov d7, r2, r3 // move second param from r2/r3 pair into d7 + vdiv.f64 d5, d6, d7 + vmov r0, r1, d5 // move result back to r0/r1 pair bx lr diff --git a/contrib/compiler-rt/lib/arm/divsf3vfp.S b/contrib/compiler-rt/lib/arm/divsf3vfp.S index 9eefcf31e..81ba903 100644 --- a/contrib/compiler-rt/lib/arm/divsf3vfp.S +++ b/contrib/compiler-rt/lib/arm/divsf3vfp.S @@ -15,10 +15,11 @@ // Divides two single precision floating point numbers using the Darwin // calling convention where single arguments are passsed like 32-bit ints. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__divsf3vfp) - fmsr s14, r0 // move first param from r0 into float register - fmsr s15, r1 // move second param from r1 into float register - fdivs s13, s14, s15 - fmrs r0, s13 // move result back to r0 + vmov s14, r0 // move first param from r0 into float register + vmov s15, r1 // move second param from r1 into float register + vdiv.f32 s13, s14, s15 + vmov r0, s13 // move result back to r0 bx lr diff --git a/contrib/compiler-rt/lib/arm/eqdf2vfp.S b/contrib/compiler-rt/lib/arm/eqdf2vfp.S index 2998a76..c41e55a 100644 --- a/contrib/compiler-rt/lib/arm/eqdf2vfp.S +++ b/contrib/compiler-rt/lib/arm/eqdf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__eqdf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr moveq r0, #1 // set result register to 1 if equal movne r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/eqsf2vfp.S b/contrib/compiler-rt/lib/arm/eqsf2vfp.S index 927566e..730ef88 100644 --- a/contrib/compiler-rt/lib/arm/eqsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/eqsf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__eqsf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr moveq r0, #1 // set result register to 1 if equal movne r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S b/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S index b1aa88e..17a146e 100644 --- a/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S +++ b/contrib/compiler-rt/lib/arm/extendsfdf2vfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a single precision parameter is // passed in a GPR and a double precision result is returned in R0/R1 pair. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__extendsfdf2vfp) - fmsr s15, r0 // load float register from R0 - fcvtds d7, s15 // convert single to double - fmrrd r0, r1, d7 // return result in r0/r1 pair + vmov s15, r0 // load float register from R0 + vcvt.f64.f32 d7, s15 // convert single to double + vmov r0, r1, d7 // return result in r0/r1 pair bx lr diff --git a/contrib/compiler-rt/lib/arm/fixdfsivfp.S b/contrib/compiler-rt/lib/arm/fixdfsivfp.S index 0285a17..b7c3299 100644 --- a/contrib/compiler-rt/lib/arm/fixdfsivfp.S +++ b/contrib/compiler-rt/lib/arm/fixdfsivfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a double precision parameter is // passed in GPR register pair. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__fixdfsivfp) - fmdrr d7, r0, r1 // load double register from R0/R1 - ftosizd s15, d7 // convert double to 32-bit int into s15 - fmrs r0, s15 // move s15 to result register + vmov d7, r0, r1 // load double register from R0/R1 + vcvt.s32.f64 s15, d7 // convert double to 32-bit int into s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/fixsfsivfp.S b/contrib/compiler-rt/lib/arm/fixsfsivfp.S index d05ba74..1cea6a4 100644 --- a/contrib/compiler-rt/lib/arm/fixsfsivfp.S +++ b/contrib/compiler-rt/lib/arm/fixsfsivfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a single precision parameter is // passed in a GPR.. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__fixsfsivfp) - fmsr s15, r0 // load float register from R0 - ftosizs s15, s15 // convert single to 32-bit int into s15 - fmrs r0, s15 // move s15 to result register + vmov s15, r0 // load float register from R0 + vcvt.s32.f32 s15, s15 // convert single to 32-bit int into s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S b/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S index ddb703c..54b0359 100644 --- a/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S +++ b/contrib/compiler-rt/lib/arm/fixunsdfsivfp.S @@ -17,9 +17,10 @@ // Uses Darwin calling convention where a double precision parameter is // passed in GPR register pair. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__fixunsdfsivfp) - fmdrr d7, r0, r1 // load double register from R0/R1 - ftouizd s15, d7 // convert double to 32-bit int into s15 - fmrs r0, s15 // move s15 to result register + vmov d7, r0, r1 // load double register from R0/R1 + vcvt.u32.f64 s15, d7 // convert double to 32-bit int into s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/fixunssfsivfp.S b/contrib/compiler-rt/lib/arm/fixunssfsivfp.S index afbb64f..12adb52 100644 --- a/contrib/compiler-rt/lib/arm/fixunssfsivfp.S +++ b/contrib/compiler-rt/lib/arm/fixunssfsivfp.S @@ -17,9 +17,10 @@ // Uses Darwin calling convention where a single precision parameter is // passed in a GPR.. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__fixunssfsivfp) - fmsr s15, r0 // load float register from R0 - ftouizs s15, s15 // convert single to 32-bit unsigned into s15 - fmrs r0, s15 // move s15 to result register + vmov s15, r0 // load float register from R0 + vcvt.u32.f32 s15, s15 // convert single to 32-bit unsigned into s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/floatsidfvfp.S b/contrib/compiler-rt/lib/arm/floatsidfvfp.S index fe3366a..e6a1eb3 100644 --- a/contrib/compiler-rt/lib/arm/floatsidfvfp.S +++ b/contrib/compiler-rt/lib/arm/floatsidfvfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a double precision result is // return in GPR register pair. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__floatsidfvfp) - fmsr s15, r0 // move int to float register s15 - fsitod d7, s15 // convert 32-bit int in s15 to double in d7 - fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + vmov s15, r0 // move int to float register s15 + vcvt.f64.s32 d7, s15 // convert 32-bit int in s15 to double in d7 + vmov r0, r1, d7 // move d7 to result register pair r0/r1 bx lr diff --git a/contrib/compiler-rt/lib/arm/floatsisfvfp.S b/contrib/compiler-rt/lib/arm/floatsisfvfp.S index 5b41610..0d3a24f 100644 --- a/contrib/compiler-rt/lib/arm/floatsisfvfp.S +++ b/contrib/compiler-rt/lib/arm/floatsisfvfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a single precision result is // return in a GPR.. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__floatsisfvfp) - fmsr s15, r0 // move int to float register s15 - fsitos s15, s15 // convert 32-bit int in s15 to float in s15 - fmrs r0, s15 // move s15 to result register + vmov s15, r0 // move int to float register s15 + vcvt.f32.s32 s15, s15 // convert 32-bit int in s15 to float in s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/floatunssidfvfp.S b/contrib/compiler-rt/lib/arm/floatunssidfvfp.S index 9b22a6f..770b202 100644 --- a/contrib/compiler-rt/lib/arm/floatunssidfvfp.S +++ b/contrib/compiler-rt/lib/arm/floatunssidfvfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a double precision result is // return in GPR register pair. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__floatunssidfvfp) - fmsr s15, r0 // move int to float register s15 - fuitod d7, s15 // convert 32-bit int in s15 to double in d7 - fmrrd r0, r1, d7 // move d7 to result register pair r0/r1 + vmov s15, r0 // move int to float register s15 + vcvt.f64.u32 d7, s15 // convert 32-bit int in s15 to double in d7 + vmov r0, r1, d7 // move d7 to result register pair r0/r1 bx lr diff --git a/contrib/compiler-rt/lib/arm/floatunssisfvfp.S b/contrib/compiler-rt/lib/arm/floatunssisfvfp.S index 44d5e93..16b3ffb 100644 --- a/contrib/compiler-rt/lib/arm/floatunssisfvfp.S +++ b/contrib/compiler-rt/lib/arm/floatunssisfvfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a single precision result is // return in a GPR.. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__floatunssisfvfp) - fmsr s15, r0 // move int to float register s15 - fuitos s15, s15 // convert 32-bit int in s15 to float in s15 - fmrs r0, s15 // move s15 to result register + vmov s15, r0 // move int to float register s15 + vcvt.f32.u32 s15, s15 // convert 32-bit int in s15 to float in s15 + vmov r0, s15 // move s15 to result register bx lr diff --git a/contrib/compiler-rt/lib/arm/gedf2vfp.S b/contrib/compiler-rt/lib/arm/gedf2vfp.S index 9993f52..55603b8 100644 --- a/contrib/compiler-rt/lib/arm/gedf2vfp.S +++ b/contrib/compiler-rt/lib/arm/gedf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__gedf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movge r0, #1 // set result register to 1 if greater than or equal movlt r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/gesf2vfp.S b/contrib/compiler-rt/lib/arm/gesf2vfp.S index 9ce1682..02da35c 100644 --- a/contrib/compiler-rt/lib/arm/gesf2vfp.S +++ b/contrib/compiler-rt/lib/arm/gesf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__gesf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movge r0, #1 // set result register to 1 if greater than or equal movlt r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/gtdf2vfp.S b/contrib/compiler-rt/lib/arm/gtdf2vfp.S index 8a049c8..b5b1e14 100644 --- a/contrib/compiler-rt/lib/arm/gtdf2vfp.S +++ b/contrib/compiler-rt/lib/arm/gtdf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__gtdf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movgt r0, #1 // set result register to 1 if equal movle r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/gtsf2vfp.S b/contrib/compiler-rt/lib/arm/gtsf2vfp.S index 1ffe1ec..685a9ce 100644 --- a/contrib/compiler-rt/lib/arm/gtsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/gtsf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__gtsf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movgt r0, #1 // set result register to 1 if equal movle r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/ledf2vfp.S b/contrib/compiler-rt/lib/arm/ledf2vfp.S index a04d0f2..6e140dd 100644 --- a/contrib/compiler-rt/lib/arm/ledf2vfp.S +++ b/contrib/compiler-rt/lib/arm/ledf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__ledf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movls r0, #1 // set result register to 1 if equal movhi r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/lesf2vfp.S b/contrib/compiler-rt/lib/arm/lesf2vfp.S index 3011200..7b28250 100644 --- a/contrib/compiler-rt/lib/arm/lesf2vfp.S +++ b/contrib/compiler-rt/lib/arm/lesf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__lesf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movls r0, #1 // set result register to 1 if equal movhi r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/ltdf2vfp.S b/contrib/compiler-rt/lib/arm/ltdf2vfp.S index 87144a8..a09e67a 100644 --- a/contrib/compiler-rt/lib/arm/ltdf2vfp.S +++ b/contrib/compiler-rt/lib/arm/ltdf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__ltdf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movmi r0, #1 // set result register to 1 if equal movpl r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/ltsf2vfp.S b/contrib/compiler-rt/lib/arm/ltsf2vfp.S index ca06ae2..8c7f9a8 100644 --- a/contrib/compiler-rt/lib/arm/ltsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/ltsf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__ltsf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movmi r0, #1 // set result register to 1 if equal movpl r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/muldf3vfp.S b/contrib/compiler-rt/lib/arm/muldf3vfp.S index 96bba06..838581e 100644 --- a/contrib/compiler-rt/lib/arm/muldf3vfp.S +++ b/contrib/compiler-rt/lib/arm/muldf3vfp.S @@ -15,10 +15,11 @@ // Multiplies two double precision floating point numbers using the Darwin // calling convention where double arguments are passsed in GPR pairs // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__muldf3vfp) - fmdrr d6, r0, r1 // move first param from r0/r1 pair into d6 - fmdrr d7, r2, r3 // move second param from r2/r3 pair into d7 - fmuld d6, d6, d7 - fmrrd r0, r1, d6 // move result back to r0/r1 pair + vmov d6, r0, r1 // move first param from r0/r1 pair into d6 + vmov d7, r2, r3 // move second param from r2/r3 pair into d7 + vmul.f64 d6, d6, d7 + vmov r0, r1, d6 // move result back to r0/r1 pair bx lr diff --git a/contrib/compiler-rt/lib/arm/mulsf3vfp.S b/contrib/compiler-rt/lib/arm/mulsf3vfp.S index c56991d..ea25913 100644 --- a/contrib/compiler-rt/lib/arm/mulsf3vfp.S +++ b/contrib/compiler-rt/lib/arm/mulsf3vfp.S @@ -15,10 +15,11 @@ // Multiplies two single precision floating point numbers using the Darwin // calling convention where single arguments are passsed like 32-bit ints. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__mulsf3vfp) - fmsr s14, r0 // move first param from r0 into float register - fmsr s15, r1 // move second param from r1 into float register - fmuls s13, s14, s15 - fmrs r0, s13 // move result back to r0 + vmov s14, r0 // move first param from r0 into float register + vmov s15, r1 // move second param from r1 into float register + vmul.f32 s13, s14, s15 + vmov r0, s13 // move result back to r0 bx lr diff --git a/contrib/compiler-rt/lib/arm/nedf2vfp.S b/contrib/compiler-rt/lib/arm/nedf2vfp.S index a02b09c..2167081 100644 --- a/contrib/compiler-rt/lib/arm/nedf2vfp.S +++ b/contrib/compiler-rt/lib/arm/nedf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__nedf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movne r0, #1 // set result register to 0 if unequal moveq r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/negdf2vfp.S b/contrib/compiler-rt/lib/arm/negdf2vfp.S index 100f4fd..64c9b69 100644 --- a/contrib/compiler-rt/lib/arm/negdf2vfp.S +++ b/contrib/compiler-rt/lib/arm/negdf2vfp.S @@ -15,6 +15,7 @@ // Returns the negation a double precision floating point numbers using the // Darwin calling convention where double arguments are passsed in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__negdf2vfp) eor r1, r1, #-2147483648 // flip sign bit on double in r0/r1 pair diff --git a/contrib/compiler-rt/lib/arm/negsf2vfp.S b/contrib/compiler-rt/lib/arm/negsf2vfp.S index f96c8ad..b883b73 100644 --- a/contrib/compiler-rt/lib/arm/negsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/negsf2vfp.S @@ -15,6 +15,7 @@ // Returns the negation of a single precision floating point numbers using the // Darwin calling convention where single arguments are passsed like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__negsf2vfp) eor r0, r0, #-2147483648 // flip sign bit on float in r0 diff --git a/contrib/compiler-rt/lib/arm/nesf2vfp.S b/contrib/compiler-rt/lib/arm/nesf2vfp.S index d620549..fa7aa80 100644 --- a/contrib/compiler-rt/lib/arm/nesf2vfp.S +++ b/contrib/compiler-rt/lib/arm/nesf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__nesf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movne r0, #1 // set result register to 1 if unequal moveq r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/subdf3vfp.S b/contrib/compiler-rt/lib/arm/subdf3vfp.S index ff53b30..3f88baa 100644 --- a/contrib/compiler-rt/lib/arm/subdf3vfp.S +++ b/contrib/compiler-rt/lib/arm/subdf3vfp.S @@ -15,10 +15,11 @@ // Returns difference between two double precision floating point numbers using // the Darwin calling convention where double arguments are passsed in GPR pairs // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__subdf3vfp) - fmdrr d6, r0, r1 // move first param from r0/r1 pair into d6 - fmdrr d7, r2, r3 // move second param from r2/r3 pair into d7 - fsubd d6, d6, d7 - fmrrd r0, r1, d6 // move result back to r0/r1 pair + vmov d6, r0, r1 // move first param from r0/r1 pair into d6 + vmov d7, r2, r3 // move second param from r2/r3 pair into d7 + vsub.f64 d6, d6, d7 + vmov r0, r1, d6 // move result back to r0/r1 pair bx lr diff --git a/contrib/compiler-rt/lib/arm/subsf3vfp.S b/contrib/compiler-rt/lib/arm/subsf3vfp.S index 238f3f0..ed02ba9 100644 --- a/contrib/compiler-rt/lib/arm/subsf3vfp.S +++ b/contrib/compiler-rt/lib/arm/subsf3vfp.S @@ -16,10 +16,11 @@ // using the Darwin calling convention where single arguments are passsed // like 32-bit ints. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__subsf3vfp) - fmsr s14, r0 // move first param from r0 into float register - fmsr s15, r1 // move second param from r1 into float register - fsubs s14, s14, s15 - fmrs r0, s14 // move result back to r0 + vmov s14, r0 // move first param from r0 into float register + vmov s15, r1 // move second param from r1 into float register + vsub.f32 s14, s14, s15 + vmov r0, s14 // move result back to r0 bx lr diff --git a/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S b/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S index 6e55c7f..371aee94 100644 --- a/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/truncdfsf2vfp.S @@ -16,9 +16,10 @@ // Uses Darwin calling convention where a double precision parameter is // passed in a R0/R1 pair and a signle precision result is returned in R0. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__truncdfsf2vfp) - fmdrr d7, r0, r1 // load double from r0/r1 pair - fcvtsd s15, d7 // convert double to single (trucate precision) - fmrs r0, s15 // return result in r0 + vmov d7, r0, r1 // load double from r0/r1 pair + vcvt.f32.f64 s15, d7 // convert double to single (trucate precision) + vmov r0, s15 // return result in r0 bx lr diff --git a/contrib/compiler-rt/lib/arm/unorddf2vfp.S b/contrib/compiler-rt/lib/arm/unorddf2vfp.S index 9b52131..c49e55f 100644 --- a/contrib/compiler-rt/lib/arm/unorddf2vfp.S +++ b/contrib/compiler-rt/lib/arm/unorddf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where double precision arguments are passsed // like in GPR pairs. // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__unorddf2vfp) - fmdrr d6, r0, r1 // load r0/r1 pair in double register - fmdrr d7, r2, r3 // load r2/r3 pair in double register - fcmpd d6, d7 - fmstat + vmov d6, r0, r1 // load r0/r1 pair in double register + vmov d7, r2, r3 // load r2/r3 pair in double register + vcmp.f64 d6, d7 + vmrs apsr_nzcv, fpscr movvs r0, #1 // set result register to 1 if "overflow" (any NaNs) movvc r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/arm/unordsf2vfp.S b/contrib/compiler-rt/lib/arm/unordsf2vfp.S index e486533..0ab27ed 100644 --- a/contrib/compiler-rt/lib/arm/unordsf2vfp.S +++ b/contrib/compiler-rt/lib/arm/unordsf2vfp.S @@ -16,12 +16,13 @@ // Uses Darwin calling convention where single precision arguments are passsed // like 32-bit ints // + .syntax unified .align 2 DEFINE_COMPILERRT_FUNCTION(__unordsf2vfp) - fmsr s14, r0 // move from GPR 0 to float register - fmsr s15, r1 // move from GPR 1 to float register - fcmps s14, s15 - fmstat + vmov s14, r0 // move from GPR 0 to float register + vmov s15, r1 // move from GPR 1 to float register + vcmp.f32 s14, s15 + vmrs apsr_nzcv, fpscr movvs r0, #1 // set result register to 1 if "overflow" (any NaNs) movvc r0, #0 bx lr diff --git a/contrib/compiler-rt/lib/ashldi3.c b/contrib/compiler-rt/lib/ashldi3.c index adce4e2..6c558fe 100644 --- a/contrib/compiler-rt/lib/ashldi3.c +++ b/contrib/compiler-rt/lib/ashldi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/ashrdi3.c b/contrib/compiler-rt/lib/ashrdi3.c index 03692a3..38ab716 100644 --- a/contrib/compiler-rt/lib/ashrdi3.c +++ b/contrib/compiler-rt/lib/ashrdi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/assembly.h b/contrib/compiler-rt/lib/assembly.h index 0ce83ac..83bed12 100644 --- a/contrib/compiler-rt/lib/assembly.h +++ b/contrib/compiler-rt/lib/assembly.h @@ -35,15 +35,16 @@ #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) #ifdef VISIBILITY_HIDDEN -#define DEFINE_COMPILERRT_FUNCTION(name) \ - .globl SYMBOL_NAME(name) SEPARATOR \ - HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \ - SYMBOL_NAME(name): +#define DECLARE_SYMBOL_VISIBILITY(name) \ + HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR #else +#define DECLARE_SYMBOL_VISIBILITY(name) +#endif + #define DEFINE_COMPILERRT_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ + DECLARE_SYMBOL_VISIBILITY(name) \ SYMBOL_NAME(name): -#endif #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ diff --git a/contrib/compiler-rt/lib/clear_cache.c b/contrib/compiler-rt/lib/clear_cache.c index 7b59a7f..b934fd4 100644 --- a/contrib/compiler-rt/lib/clear_cache.c +++ b/contrib/compiler-rt/lib/clear_cache.c @@ -9,7 +9,6 @@ */ #include "int_lib.h" -#include <stdlib.h> #if __APPLE__ #include <libkern/OSCacheControl.h> diff --git a/contrib/compiler-rt/lib/clzdi2.c b/contrib/compiler-rt/lib/clzdi2.c index c281945..b9e64da 100644 --- a/contrib/compiler-rt/lib/clzdi2.c +++ b/contrib/compiler-rt/lib/clzdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/clzsi2.c b/contrib/compiler-rt/lib/clzsi2.c index d0a6aea..25b8ed2 100644 --- a/contrib/compiler-rt/lib/clzsi2.c +++ b/contrib/compiler-rt/lib/clzsi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/cmpdi2.c b/contrib/compiler-rt/lib/cmpdi2.c index 999c3d2..c2b1f69 100644 --- a/contrib/compiler-rt/lib/cmpdi2.c +++ b/contrib/compiler-rt/lib/cmpdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/ctzdi2.c b/contrib/compiler-rt/lib/ctzdi2.c index b3d37d0..db3c6fd 100644 --- a/contrib/compiler-rt/lib/ctzdi2.c +++ b/contrib/compiler-rt/lib/ctzdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/ctzsi2.c b/contrib/compiler-rt/lib/ctzsi2.c index 2ff0e5d..c69486e 100644 --- a/contrib/compiler-rt/lib/ctzsi2.c +++ b/contrib/compiler-rt/lib/ctzsi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/divdc3.c b/contrib/compiler-rt/lib/divdc3.c index 5f63298..cfbc498 100644 --- a/contrib/compiler-rt/lib/divdc3.c +++ b/contrib/compiler-rt/lib/divdc3.c @@ -13,8 +13,7 @@ */ #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the quotient of (a + ib) / (c + id) */ @@ -22,35 +21,37 @@ double _Complex __divdc3(double __a, double __b, double __c, double __d) { int __ilogbw = 0; - double __logbw = logb(fmax(fabs(__c), fabs(__d))); - if (isfinite(__logbw)) + 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); - if (isnan(__real__ z) && isnan(__imag__ z)) + __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) && (!isnan(__a) || !isnan(__b))) + 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 ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d)) + else if ((crt_isinf(__a) || crt_isinf(__b)) && + crt_isfinite(__c) && crt_isfinite(__d)) { - __a = copysign(isinf(__a) ? 1.0 : 0.0, __a); - __b = copysign(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 (isinf(__logbw) && __logbw > 0.0 && isfinite(__a) && isfinite(__b)) + else if (crt_isinf(__logbw) && __logbw > 0.0 && + crt_isfinite(__a) && crt_isfinite(__b)) { - __c = copysign(isinf(__c) ? 1.0 : 0.0, __c); - __d = copysign(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); } diff --git a/contrib/compiler-rt/lib/divdf3.c b/contrib/compiler-rt/lib/divdf3.c index 925abd5..cc034dd 100644 --- a/contrib/compiler-rt/lib/divdf3.c +++ b/contrib/compiler-rt/lib/divdf3.c @@ -15,7 +15,6 @@ // underflow with correct rounding. // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/divdi3.c b/contrib/compiler-rt/lib/divdi3.c index d62df56..2c2bcc2 100644 --- a/contrib/compiler-rt/lib/divdi3.c +++ b/contrib/compiler-rt/lib/divdi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/divmoddi4.c b/contrib/compiler-rt/lib/divmoddi4.c index d3ca745..a2b8714 100644 --- a/contrib/compiler-rt/lib/divmoddi4.c +++ b/contrib/compiler-rt/lib/divmoddi4.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/divmodsi4.c b/contrib/compiler-rt/lib/divmodsi4.c index 4dc1978..c7f7b1a 100644 --- a/contrib/compiler-rt/lib/divmodsi4.c +++ b/contrib/compiler-rt/lib/divmodsi4.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/divsc3.c b/contrib/compiler-rt/lib/divsc3.c index a05f429..caa0c407 100644 --- a/contrib/compiler-rt/lib/divsc3.c +++ b/contrib/compiler-rt/lib/divsc3.c @@ -13,8 +13,7 @@ */ #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the quotient of (a + ib) / (c + id) */ @@ -22,35 +21,37 @@ float _Complex __divsc3(float __a, float __b, float __c, float __d) { int __ilogbw = 0; - float __logbw = logbf(fmaxf(fabsf(__c), fabsf(__d))); - if (isfinite(__logbw)) + float __logbw = crt_logbf(crt_fmaxf(crt_fabsf(__c), crt_fabsf(__d))); + if (crt_isfinite(__logbw)) { __ilogbw = (int)__logbw; - __c = scalbnf(__c, -__ilogbw); - __d = scalbnf(__d, -__ilogbw); + __c = crt_scalbnf(__c, -__ilogbw); + __d = crt_scalbnf(__d, -__ilogbw); } float __denom = __c * __c + __d * __d; float _Complex z; - __real__ z = scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw); - __imag__ z = scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw); - if (isnan(__real__ z) && isnan(__imag__ z)) + __real__ z = crt_scalbnf((__a * __c + __b * __d) / __denom, -__ilogbw); + __imag__ z = crt_scalbnf((__b * __c - __a * __d) / __denom, -__ilogbw); + if (crt_isnan(__real__ z) && crt_isnan(__imag__ z)) { - if ((__denom == 0) && (!isnan(__a) || !isnan(__b))) + if ((__denom == 0) && (!crt_isnan(__a) || !crt_isnan(__b))) { - __real__ z = copysignf(INFINITY, __c) * __a; - __imag__ z = copysignf(INFINITY, __c) * __b; + __real__ z = crt_copysignf(CRT_INFINITY, __c) * __a; + __imag__ z = crt_copysignf(CRT_INFINITY, __c) * __b; } - else if ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d)) + else if ((crt_isinf(__a) || crt_isinf(__b)) && + crt_isfinite(__c) && crt_isfinite(__d)) { - __a = copysignf(isinf(__a) ? 1 : 0, __a); - __b = copysignf(isinf(__b) ? 1 : 0, __b); - __real__ z = INFINITY * (__a * __c + __b * __d); - __imag__ z = INFINITY * (__b * __c - __a * __d); + __a = crt_copysignf(crt_isinf(__a) ? 1 : 0, __a); + __b = crt_copysignf(crt_isinf(__b) ? 1 : 0, __b); + __real__ z = CRT_INFINITY * (__a * __c + __b * __d); + __imag__ z = CRT_INFINITY * (__b * __c - __a * __d); } - else if (isinf(__logbw) && __logbw > 0 && isfinite(__a) && isfinite(__b)) + else if (crt_isinf(__logbw) && __logbw > 0 && + crt_isfinite(__a) && crt_isfinite(__b)) { - __c = copysignf(isinf(__c) ? 1 : 0, __c); - __d = copysignf(isinf(__d) ? 1 : 0, __d); + __c = crt_copysignf(crt_isinf(__c) ? 1 : 0, __c); + __d = crt_copysignf(crt_isinf(__d) ? 1 : 0, __d); __real__ z = 0 * (__a * __c + __b * __d); __imag__ z = 0 * (__b * __c - __a * __d); } diff --git a/contrib/compiler-rt/lib/divsf3.c b/contrib/compiler-rt/lib/divsf3.c index b733307..a8230e4 100644 --- a/contrib/compiler-rt/lib/divsf3.c +++ b/contrib/compiler-rt/lib/divsf3.c @@ -15,7 +15,6 @@ // underflow with correct rounding. // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/divsi3.c b/contrib/compiler-rt/lib/divsi3.c index 01ef274..0d81cb8 100644 --- a/contrib/compiler-rt/lib/divsi3.c +++ b/contrib/compiler-rt/lib/divsi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/divxc3.c b/contrib/compiler-rt/lib/divxc3.c index f054d40..5f240e9 100644 --- a/contrib/compiler-rt/lib/divxc3.c +++ b/contrib/compiler-rt/lib/divxc3.c @@ -14,8 +14,7 @@ #if !_ARCH_PPC #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the quotient of (a + ib) / (c + id) */ @@ -23,35 +22,37 @@ long double _Complex __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))); - if (isfinite(__logbw)) + 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); - if (isnan(__real__ z) && isnan(__imag__ z)) + __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) && (!isnan(__a) || !isnan(__b))) + 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 ((isinf(__a) || isinf(__b)) && isfinite(__c) && isfinite(__d)) + else if ((crt_isinf(__a) || crt_isinf(__b)) && + crt_isfinite(__c) && crt_isfinite(__d)) { - __a = copysignl(isinf(__a) ? 1 : 0, __a); - __b = copysignl(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 (isinf(__logbw) && __logbw > 0 && isfinite(__a) && isfinite(__b)) + else if (crt_isinf(__logbw) && __logbw > 0 && + crt_isfinite(__a) && crt_isfinite(__b)) { - __c = copysignl(isinf(__c) ? 1 : 0, __c); - __d = copysignl(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); } diff --git a/contrib/compiler-rt/lib/enable_execute_stack.c b/contrib/compiler-rt/lib/enable_execute_stack.c index 7ab8e8d..278ca24 100644 --- a/contrib/compiler-rt/lib/enable_execute_stack.c +++ b/contrib/compiler-rt/lib/enable_execute_stack.c @@ -8,7 +8,8 @@ * ===----------------------------------------------------------------------=== */ -#include <stdint.h> +#include "int_lib.h" + #include <sys/mman.h> /* #include "config.h" diff --git a/contrib/compiler-rt/lib/eprintf.c b/contrib/compiler-rt/lib/eprintf.c index 7c79174..b07d624 100644 --- a/contrib/compiler-rt/lib/eprintf.c +++ b/contrib/compiler-rt/lib/eprintf.c @@ -12,7 +12,6 @@ #include "int_lib.h" #include <stdio.h> -#include <stdlib.h> /* diff --git a/contrib/compiler-rt/lib/extendsfdf2.c b/contrib/compiler-rt/lib/extendsfdf2.c index c0b628d..9466de7 100644 --- a/contrib/compiler-rt/lib/extendsfdf2.c +++ b/contrib/compiler-rt/lib/extendsfdf2.c @@ -38,10 +38,7 @@ // //===----------------------------------------------------------------------===// -#include <stdint.h> -#include <limits.h> - -#include "abi.h" +#include "int_lib.h" typedef float src_t; typedef uint32_t src_rep_t; diff --git a/contrib/compiler-rt/lib/ffsdi2.c b/contrib/compiler-rt/lib/ffsdi2.c index 89f1b7b..a5ac990 100644 --- a/contrib/compiler-rt/lib/ffsdi2.c +++ b/contrib/compiler-rt/lib/ffsdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/fixdfdi.c b/contrib/compiler-rt/lib/fixdfdi.c index 85a456d..c6732db 100644 --- a/contrib/compiler-rt/lib/fixdfdi.c +++ b/contrib/compiler-rt/lib/fixdfdi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/fixdfsi.c b/contrib/compiler-rt/lib/fixdfsi.c index fbcf147..3d4379e 100644 --- a/contrib/compiler-rt/lib/fixdfsi.c +++ b/contrib/compiler-rt/lib/fixdfsi.c @@ -12,7 +12,6 @@ // conversion is undefined for out of range values in the C standard. // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/fixsfdi.c b/contrib/compiler-rt/lib/fixsfdi.c index d80e33e..81ceab0 100644 --- a/contrib/compiler-rt/lib/fixsfdi.c +++ b/contrib/compiler-rt/lib/fixsfdi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/fixsfsi.c b/contrib/compiler-rt/lib/fixsfsi.c index 67749a5..f6de609 100644 --- a/contrib/compiler-rt/lib/fixsfsi.c +++ b/contrib/compiler-rt/lib/fixsfsi.c @@ -12,7 +12,6 @@ // conversion is undefined for out of range values in the C standard. // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/fixunsdfdi.c b/contrib/compiler-rt/lib/fixunsdfdi.c index d80b84a..c0ff160 100644 --- a/contrib/compiler-rt/lib/fixunsdfdi.c +++ b/contrib/compiler-rt/lib/fixunsdfdi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/fixunsdfsi.c b/contrib/compiler-rt/lib/fixunsdfsi.c index ecdfb5d..2ce4999 100644 --- a/contrib/compiler-rt/lib/fixunsdfsi.c +++ b/contrib/compiler-rt/lib/fixunsdfsi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/fixunssfdi.c b/contrib/compiler-rt/lib/fixunssfdi.c index 1506420..09078db 100644 --- a/contrib/compiler-rt/lib/fixunssfdi.c +++ b/contrib/compiler-rt/lib/fixunssfdi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" /* Returns: convert a to a unsigned long long, rounding toward zero. diff --git a/contrib/compiler-rt/lib/fixunssfsi.c b/contrib/compiler-rt/lib/fixunssfsi.c index dbaa511..d80ed18 100644 --- a/contrib/compiler-rt/lib/fixunssfsi.c +++ b/contrib/compiler-rt/lib/fixunssfsi.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/floatdidf.c b/contrib/compiler-rt/lib/floatdidf.c index 5ba9526..2af9e10 100644 --- a/contrib/compiler-rt/lib/floatdidf.c +++ b/contrib/compiler-rt/lib/floatdidf.c @@ -11,10 +11,8 @@ * *===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <float.h> /* Returns: convert a to a double, rounding toward even. */ @@ -30,7 +28,6 @@ ARM_EABI_FNALIAS(l2d, floatdidf); /* Support for systems that have hardware floating-point; we'll set the inexact flag * as a side-effect of this computation. */ -#include <stdint.h> COMPILER_RT_ABI double __floatdidf(di_int a) diff --git a/contrib/compiler-rt/lib/floatdisf.c b/contrib/compiler-rt/lib/floatdisf.c index 4dc13ca..6607307 100644 --- a/contrib/compiler-rt/lib/floatdisf.c +++ b/contrib/compiler-rt/lib/floatdisf.c @@ -12,9 +12,6 @@ *===----------------------------------------------------------------------=== */ -#include "abi.h" -#include <float.h> - /* Returns: convert a to a float, rounding toward even.*/ /* Assumption: float is a IEEE 32 bit floating point type diff --git a/contrib/compiler-rt/lib/floatsidf.c b/contrib/compiler-rt/lib/floatsidf.c index 7227335..74cb66b 100644 --- a/contrib/compiler-rt/lib/floatsidf.c +++ b/contrib/compiler-rt/lib/floatsidf.c @@ -12,7 +12,6 @@ // mode. // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/floatsisf.c b/contrib/compiler-rt/lib/floatsisf.c index e5250ff..a981391 100644 --- a/contrib/compiler-rt/lib/floatsisf.c +++ b/contrib/compiler-rt/lib/floatsisf.c @@ -12,7 +12,6 @@ // mode. // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/floattidf.c b/contrib/compiler-rt/lib/floattidf.c index f61844d..3cafea8 100644 --- a/contrib/compiler-rt/lib/floattidf.c +++ b/contrib/compiler-rt/lib/floattidf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a double, rounding toward even.*/ diff --git a/contrib/compiler-rt/lib/floattisf.c b/contrib/compiler-rt/lib/floattisf.c index 7eb761d..ab33e4a 100644 --- a/contrib/compiler-rt/lib/floattisf.c +++ b/contrib/compiler-rt/lib/floattisf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a float, rounding toward even. */ diff --git a/contrib/compiler-rt/lib/floattixf.c b/contrib/compiler-rt/lib/floattixf.c index e4bcb5f..852acc7 100644 --- a/contrib/compiler-rt/lib/floattixf.c +++ b/contrib/compiler-rt/lib/floattixf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a long double, rounding toward even. */ diff --git a/contrib/compiler-rt/lib/floatundidf.c b/contrib/compiler-rt/lib/floatundidf.c index e74e9d8..6791701 100644 --- a/contrib/compiler-rt/lib/floatundidf.c +++ b/contrib/compiler-rt/lib/floatundidf.c @@ -12,9 +12,6 @@ * ===----------------------------------------------------------------------=== */ -#include "abi.h" -#include <float.h> - /* Returns: convert a to a double, rounding toward even. */ /* Assumption: double is a IEEE 64 bit floating point type @@ -32,7 +29,6 @@ ARM_EABI_FNALIAS(ul2d, floatundidf); * as a side-effect of this computation. */ -#include <stdint.h> COMPILER_RT_ABI double __floatundidf(du_int a) diff --git a/contrib/compiler-rt/lib/floatundisf.c b/contrib/compiler-rt/lib/floatundisf.c index eea45a7..1bf5fbb 100644 --- a/contrib/compiler-rt/lib/floatundisf.c +++ b/contrib/compiler-rt/lib/floatundisf.c @@ -12,9 +12,6 @@ *===----------------------------------------------------------------------=== */ -#include "abi.h" -#include <float.h> - /* Returns: convert a to a float, rounding toward even. */ /* Assumption: float is a IEEE 32 bit floating point type diff --git a/contrib/compiler-rt/lib/floatunsidf.c b/contrib/compiler-rt/lib/floatunsidf.c index 3756299..0722248 100644 --- a/contrib/compiler-rt/lib/floatunsidf.c +++ b/contrib/compiler-rt/lib/floatunsidf.c @@ -12,7 +12,6 @@ // mode. // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/floatunsisf.c b/contrib/compiler-rt/lib/floatunsisf.c index 14ef103..3dc1cd4 100644 --- a/contrib/compiler-rt/lib/floatunsisf.c +++ b/contrib/compiler-rt/lib/floatunsisf.c @@ -12,7 +12,6 @@ // mode. // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/floatuntidf.c b/contrib/compiler-rt/lib/floatuntidf.c index bab7483..d0889a0 100644 --- a/contrib/compiler-rt/lib/floatuntidf.c +++ b/contrib/compiler-rt/lib/floatuntidf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a double, rounding toward even. */ diff --git a/contrib/compiler-rt/lib/floatuntisf.c b/contrib/compiler-rt/lib/floatuntisf.c index 0ab6d7e..f552758 100644 --- a/contrib/compiler-rt/lib/floatuntisf.c +++ b/contrib/compiler-rt/lib/floatuntisf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a float, rounding toward even. */ diff --git a/contrib/compiler-rt/lib/floatuntixf.c b/contrib/compiler-rt/lib/floatuntixf.c index a84709a..00c07d8 100644 --- a/contrib/compiler-rt/lib/floatuntixf.c +++ b/contrib/compiler-rt/lib/floatuntixf.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <float.h> /* Returns: convert a to a long double, rounding toward even. */ diff --git a/contrib/compiler-rt/lib/fp_lib.h b/contrib/compiler-rt/lib/fp_lib.h index 6c9455a..de5f17f 100644 --- a/contrib/compiler-rt/lib/fp_lib.h +++ b/contrib/compiler-rt/lib/fp_lib.h @@ -24,6 +24,7 @@ #include <stdint.h> #include <stdbool.h> #include <limits.h> +#include "int_lib.h" #if defined SINGLE_PRECISION diff --git a/contrib/compiler-rt/lib/gcc_personality_v0.c b/contrib/compiler-rt/lib/gcc_personality_v0.c index c840eef..8a708ca 100644 --- a/contrib/compiler-rt/lib/gcc_personality_v0.c +++ b/contrib/compiler-rt/lib/gcc_personality_v0.c @@ -9,10 +9,6 @@ * */ -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> - #include "int_lib.h" /* @@ -202,7 +198,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, /* There is nothing to do if there is no LSDA for this frame. */ const uint8_t* lsda = _Unwind_GetLanguageSpecificData(context); - if ( lsda == NULL ) + if ( lsda == (uint8_t*) 0 ) return _URC_CONTINUE_UNWIND; uintptr_t pc = _Unwind_GetIP(context)-1; diff --git a/contrib/compiler-rt/lib/endianness.h b/contrib/compiler-rt/lib/int_endianness.h index 9b7e7c1..9466ed4 100644 --- a/contrib/compiler-rt/lib/endianness.h +++ b/contrib/compiler-rt/lib/int_endianness.h @@ -1,4 +1,4 @@ -/* ===-- endianness.h - configuration header for compiler-rt ---------------=== +/* ===-- int_endianness.h - configuration header for compiler-rt ------------=== * * The LLVM Compiler Infrastructure * @@ -13,13 +13,8 @@ * ===----------------------------------------------------------------------=== */ -#ifndef ENDIANNESS_H -#define ENDIANNESS_H - -/* - * Known limitations: - * Middle endian systems are not handled currently. - */ +#ifndef INT_ENDIANNESS_H +#define INT_ENDIANNESS_H #if defined(__SVR4) && defined(__sun) #include <sys/byteorder.h> @@ -91,4 +86,4 @@ #error Unable to determine endian #endif /* Check we found an endianness correctly. */ -#endif /* ENDIANNESS_H */ +#endif /* INT_ENDIANNESS_H */ diff --git a/contrib/compiler-rt/lib/int_lib.h b/contrib/compiler-rt/lib/int_lib.h index e1fd6b7..a87426c 100644 --- a/contrib/compiler-rt/lib/int_lib.h +++ b/contrib/compiler-rt/lib/int_lib.h @@ -16,141 +16,31 @@ #ifndef INT_LIB_H #define INT_LIB_H -/* Assumption: signed integral is 2's complement */ -/* Assumption: right shift of signed negative is arithmetic shift */ +/* Assumption: Signed integral is 2's complement. */ +/* Assumption: Right shift of signed negative is arithmetic shift. */ +/* Assumption: Endianness is little or big (not mixed). */ -#include <limits.h> -#include <stdint.h> -#include "endianness.h" -#include <math.h> +/* ABI macro definitions */ -/* If compiling for kernel use, call panic() instead of abort(). */ -#ifdef KERNEL_USE -extern void panic (const char *, ...); -#define compilerrt_abort() \ - panic("%s:%d: abort in %s", __FILE__, __LINE__, __FUNCTION__) +#if __ARM_EABI__ +# define ARM_EABI_FNALIAS(aeabi_name, name) \ + void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); +# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) #else -#define compilerrt_abort() abort() +# define ARM_EABI_FNALIAS(aeabi_name, name) +# define COMPILER_RT_ABI #endif -#if !defined(INFINITY) && defined(HUGE_VAL) -#define INFINITY HUGE_VAL -#endif /* INFINITY */ - -typedef int si_int; -typedef unsigned su_int; - -typedef long long di_int; -typedef unsigned long long du_int; - -typedef union -{ - di_int all; - struct - { -#if _YUGA_LITTLE_ENDIAN - su_int low; - si_int high; -#else - si_int high; - su_int low; -#endif /* _YUGA_LITTLE_ENDIAN */ - }s; -} dwords; - -typedef union -{ - du_int all; - struct - { -#if _YUGA_LITTLE_ENDIAN - su_int low; - su_int high; -#else - su_int high; - su_int low; -#endif /* _YUGA_LITTLE_ENDIAN */ - }s; -} udwords; - -#if __x86_64 - -typedef int ti_int __attribute__ ((mode (TI))); -typedef unsigned tu_int __attribute__ ((mode (TI))); - -typedef union -{ - ti_int all; - struct - { -#if _YUGA_LITTLE_ENDIAN - du_int low; - di_int high; -#else - di_int high; - du_int low; -#endif /* _YUGA_LITTLE_ENDIAN */ - }s; -} twords; - -typedef union -{ - tu_int all; - struct - { -#if _YUGA_LITTLE_ENDIAN - du_int low; - du_int high; -#else - du_int high; - du_int low; -#endif /* _YUGA_LITTLE_ENDIAN */ - }s; -} utwords; - -static inline ti_int make_ti(di_int h, di_int l) { - twords r; - r.s.high = h; - r.s.low = l; - return r.all; -} - -static inline tu_int make_tu(du_int h, du_int l) { - utwords r; - r.s.high = h; - r.s.low = l; - return r.all; -} - -#endif /* __x86_64 */ - -typedef union -{ - su_int u; - float f; -} float_bits; - -typedef union -{ - udwords u; - double f; -} double_bits; +/* Include the standard compiler builtin headers we use functionality from. */ +#include <limits.h> +#include <stdint.h> +#include <stdbool.h> +#include <float.h> -typedef struct -{ -#if _YUGA_LITTLE_ENDIAN - udwords low; - udwords high; -#else - udwords high; - udwords low; -#endif /* _YUGA_LITTLE_ENDIAN */ -} uqwords; +/* Include the commonly used internal type definitions. */ +#include "int_types.h" -typedef union -{ - uqwords u; - long double f; -} long_double_bits; +/* Include internal utility function declarations. */ +#include "int_util.h" #endif /* INT_LIB_H */ diff --git a/contrib/compiler-rt/lib/int_math.h b/contrib/compiler-rt/lib/int_math.h new file mode 100644 index 0000000..d6b4bda --- /dev/null +++ b/contrib/compiler-rt/lib/int_math.h @@ -0,0 +1,67 @@ +/* ===-- int_math.h - internal math inlines ---------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This file is not part of the interface of this library. + * + * This file defines substitutes for the libm functions used in some of the + * compiler-rt implementations, defined in such a way that there is not a direct + * dependency on libm or math.h. Instead, we use the compiler builtin versions + * where available. This reduces our dependencies on the system SDK by foisting + * the responsibility onto the compiler. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef INT_MATH_H +#define INT_MATH_H + +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +#define CRT_INFINITY __builtin_huge_valf() + +#define crt_isinf(x) __builtin_isinf((x)) +#define crt_isnan(x) __builtin_isnan((x)) + +/* Define crt_isfinite in terms of the builtin if available, otherwise provide + * an alternate version in terms of our other functions. This supports some + * versions of GCC which didn't have __builtin_isfinite. + */ +#if __has_builtin(__builtin_isfinite) +# define crt_isfinite(x) __builtin_isfinite((x)) +#else +# define crt_isfinite(x) \ + __extension__(({ \ + __typeof((x)) x_ = (x); \ + !crt_isinf(x_) && !crt_isnan(x_); \ + })) +#endif + +#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 */ diff --git a/contrib/compiler-rt/lib/int_types.h b/contrib/compiler-rt/lib/int_types.h new file mode 100644 index 0000000..fcce390 --- /dev/null +++ b/contrib/compiler-rt/lib/int_types.h @@ -0,0 +1,140 @@ +/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is not part of the interface of this library. + * + * This file defines various standard types, most importantly a number of unions + * used to access parts of larger types. + * + * ===----------------------------------------------------------------------=== + */ + +#ifndef INT_TYPES_H +#define INT_TYPES_H + +#include "int_endianness.h" + +typedef int si_int; +typedef unsigned su_int; + +typedef long long di_int; +typedef unsigned long long du_int; + +typedef union +{ + di_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + su_int low; + si_int high; +#else + si_int high; + su_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} dwords; + +typedef union +{ + du_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + su_int low; + su_int high; +#else + su_int high; + su_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} udwords; + +#if __x86_64 + +typedef int ti_int __attribute__ ((mode (TI))); +typedef unsigned tu_int __attribute__ ((mode (TI))); + +typedef union +{ + ti_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + du_int low; + di_int high; +#else + di_int high; + du_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} twords; + +typedef union +{ + tu_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + du_int low; + du_int high; +#else + du_int high; + du_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} utwords; + +static inline ti_int make_ti(di_int h, di_int l) { + twords r; + r.s.high = h; + r.s.low = l; + return r.all; +} + +static inline tu_int make_tu(du_int h, du_int l) { + utwords r; + r.s.high = h; + r.s.low = l; + return r.all; +} + +#endif /* __x86_64 */ + +typedef union +{ + su_int u; + float f; +} float_bits; + +typedef union +{ + udwords u; + double f; +} double_bits; + +typedef struct +{ +#if _YUGA_LITTLE_ENDIAN + udwords low; + udwords high; +#else + udwords high; + udwords low; +#endif /* _YUGA_LITTLE_ENDIAN */ +} uqwords; + +typedef union +{ + uqwords u; + long double f; +} long_double_bits; + +#endif /* INT_TYPES_H */ + diff --git a/contrib/compiler-rt/lib/int_util.c b/contrib/compiler-rt/lib/int_util.c new file mode 100644 index 0000000..f194768 --- /dev/null +++ b/contrib/compiler-rt/lib/int_util.c @@ -0,0 +1,43 @@ +/* ===-- int_util.c - Implement internal utilities --------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_util.h" +#include "int_lib.h" + +/* NOTE: The definitions in this file are declared weak because we clients to be + * able to arbitrarily package individual functions into separate .a files. If + * we did not declare these weak, some link situations might end up seeing + * duplicate strong definitions of the same symbol. + * + * We can't use this solution for kernel use (which may not support weak), but + * currently expect that when built for kernel use all the functionality is + * packaged into a single library. + */ + +#ifdef KERNEL_USE + +extern void panic(const char *, ...) __attribute__((noreturn)); +__attribute__((visibility("hidden"))) +void compilerrt_abort_impl(const char *file, int line, const char *function) { + panic("%s:%d: abort in %s", file, line, function); +} + +#else + +/* Get the system definition of abort() */ +#include <stdlib.h> + +__attribute__((weak)) +__attribute__((visibility("hidden"))) +void compilerrt_abort_impl(const char *file, int line, const char *function) { + abort(); +} + +#endif diff --git a/contrib/compiler-rt/lib/int_util.h b/contrib/compiler-rt/lib/int_util.h new file mode 100644 index 0000000..17d7722 --- /dev/null +++ b/contrib/compiler-rt/lib/int_util.h @@ -0,0 +1,32 @@ +/* ===-- int_util.h - internal utility functions ----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This file is not part of the interface of this library. + * + * This file defines non-inline utilities which are available for use in the + * library. The function definitions themselves are all contained in int_util.c + * which will always be compiled into any compiler-rt library. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef INT_UTIL_H +#define INT_UTIL_H + +/** \brief Trigger a program abort (or panic for kernel code). */ +#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \ + __FUNCTION__) +void compilerrt_abort_impl(const char *file, int line, + const char *function) +#ifndef KERNEL_USE + __attribute__((weak)) +#endif + __attribute__((noreturn)) __attribute__((visibility("hidden"))); + +#endif /* INT_UTIL_H */ diff --git a/contrib/compiler-rt/lib/lshrdi3.c b/contrib/compiler-rt/lib/lshrdi3.c index 911edb1..8af3e0c 100644 --- a/contrib/compiler-rt/lib/lshrdi3.c +++ b/contrib/compiler-rt/lib/lshrdi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/moddi3.c b/contrib/compiler-rt/lib/moddi3.c index af0a8083..2f3b9cc 100644 --- a/contrib/compiler-rt/lib/moddi3.c +++ b/contrib/compiler-rt/lib/moddi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/modsi3.c b/contrib/compiler-rt/lib/modsi3.c index 05ce806..d16213c 100644 --- a/contrib/compiler-rt/lib/modsi3.c +++ b/contrib/compiler-rt/lib/modsi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/muldc3.c b/contrib/compiler-rt/lib/muldc3.c index 9f9bd2a..5f4a6d1 100644 --- a/contrib/compiler-rt/lib/muldc3.c +++ b/contrib/compiler-rt/lib/muldc3.c @@ -13,8 +13,7 @@ */ #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the product of a + ib and c + id */ @@ -28,46 +27,46 @@ __muldc3(double __a, double __b, double __c, double __d) double _Complex z; __real__ z = __ac - __bd; __imag__ z = __ad + __bc; - if (isnan(__real__ z) && isnan(__imag__ z)) + if (crt_isnan(__real__ z) && crt_isnan(__imag__ z)) { int __recalc = 0; - if (isinf(__a) || isinf(__b)) + if (crt_isinf(__a) || crt_isinf(__b)) { - __a = copysign(isinf(__a) ? 1 : 0, __a); - __b = copysign(isinf(__b) ? 1 : 0, __b); - if (isnan(__c)) - __c = copysign(0, __c); - if (isnan(__d)) - __d = copysign(0, __d); + __a = crt_copysign(crt_isinf(__a) ? 1 : 0, __a); + __b = crt_copysign(crt_isinf(__b) ? 1 : 0, __b); + if (crt_isnan(__c)) + __c = crt_copysign(0, __c); + if (crt_isnan(__d)) + __d = crt_copysign(0, __d); __recalc = 1; } - if (isinf(__c) || isinf(__d)) + if (crt_isinf(__c) || crt_isinf(__d)) { - __c = copysign(isinf(__c) ? 1 : 0, __c); - __d = copysign(isinf(__d) ? 1 : 0, __d); - if (isnan(__a)) - __a = copysign(0, __a); - if (isnan(__b)) - __b = copysign(0, __b); + __c = crt_copysign(crt_isinf(__c) ? 1 : 0, __c); + __d = crt_copysign(crt_isinf(__d) ? 1 : 0, __d); + if (crt_isnan(__a)) + __a = crt_copysign(0, __a); + if (crt_isnan(__b)) + __b = crt_copysign(0, __b); __recalc = 1; } - if (!__recalc && (isinf(__ac) || isinf(__bd) || - isinf(__ad) || isinf(__bc))) + if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) || + crt_isinf(__ad) || crt_isinf(__bc))) { - if (isnan(__a)) - __a = copysign(0, __a); - if (isnan(__b)) - __b = copysign(0, __b); - if (isnan(__c)) - __c = copysign(0, __c); - if (isnan(__d)) - __d = copysign(0, __d); + if (crt_isnan(__a)) + __a = crt_copysign(0, __a); + if (crt_isnan(__b)) + __b = crt_copysign(0, __b); + if (crt_isnan(__c)) + __c = crt_copysign(0, __c); + if (crt_isnan(__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; diff --git a/contrib/compiler-rt/lib/muldf3.c b/contrib/compiler-rt/lib/muldf3.c index f402cfb..86d72d8 100644 --- a/contrib/compiler-rt/lib/muldf3.c +++ b/contrib/compiler-rt/lib/muldf3.c @@ -11,7 +11,6 @@ // with the IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/muldi3.c b/contrib/compiler-rt/lib/muldi3.c index e6322bf..3e99630 100644 --- a/contrib/compiler-rt/lib/muldi3.c +++ b/contrib/compiler-rt/lib/muldi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/mulodi4.c b/contrib/compiler-rt/lib/mulodi4.c new file mode 100644 index 0000000..0c1b5cd --- /dev/null +++ b/contrib/compiler-rt/lib/mulodi4.c @@ -0,0 +1,58 @@ +/*===-- mulodi4.c - Implement __mulodi4 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __mulodi4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a * b */ + +/* Effects: sets *overflow to 1 if a * b overflows */ + +di_int +__mulodi4(di_int a, di_int b, int* overflow) +{ + const int N = (int)(sizeof(di_int) * CHAR_BIT); + const di_int MIN = (di_int)1 << (N-1); + const di_int MAX = ~MIN; + *overflow = 0; + di_int result = a * b; + if (a == MIN) + { + if (b != 0 && b != 1) + *overflow = 1; + return result; + } + if (b == MIN) + { + if (a != 0 && a != 1) + *overflow = 1; + return result; + } + di_int sa = a >> (N - 1); + di_int abs_a = (a ^ sa) - sa; + di_int sb = b >> (N - 1); + di_int abs_b = (b ^ sb) - sb; + if (abs_a < 2 || abs_b < 2) + return result; + if (sa == sb) + { + if (abs_a > MAX / abs_b) + *overflow = 1; + } + else + { + if (abs_a > MIN / -abs_b) + *overflow = 1; + } + return result; +} diff --git a/contrib/compiler-rt/lib/mulosi4.c b/contrib/compiler-rt/lib/mulosi4.c new file mode 100644 index 0000000..f3398d1 --- /dev/null +++ b/contrib/compiler-rt/lib/mulosi4.c @@ -0,0 +1,58 @@ +/*===-- mulosi4.c - Implement __mulosi4 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __mulosi4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a * b */ + +/* Effects: sets *overflow to 1 if a * b overflows */ + +si_int +__mulosi4(si_int a, si_int b, int* overflow) +{ + const int N = (int)(sizeof(si_int) * CHAR_BIT); + const si_int MIN = (si_int)1 << (N-1); + const si_int MAX = ~MIN; + *overflow = 0; + si_int result = a * b; + if (a == MIN) + { + if (b != 0 && b != 1) + *overflow = 1; + return result; + } + if (b == MIN) + { + if (a != 0 && a != 1) + *overflow = 1; + return result; + } + si_int sa = a >> (N - 1); + si_int abs_a = (a ^ sa) - sa; + si_int sb = b >> (N - 1); + si_int abs_b = (b ^ sb) - sb; + if (abs_a < 2 || abs_b < 2) + return result; + if (sa == sb) + { + if (abs_a > MAX / abs_b) + *overflow = 1; + } + else + { + if (abs_a > MIN / -abs_b) + *overflow = 1; + } + return result; +} diff --git a/contrib/compiler-rt/lib/muloti4.c b/contrib/compiler-rt/lib/muloti4.c new file mode 100644 index 0000000..1fcd0ba --- /dev/null +++ b/contrib/compiler-rt/lib/muloti4.c @@ -0,0 +1,62 @@ +/*===-- muloti4.c - Implement __muloti4 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __muloti4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#if __x86_64 + +#include "int_lib.h" + +/* Returns: a * b */ + +/* Effects: sets *overflow to 1 if a * b overflows */ + +ti_int +__muloti4(ti_int a, ti_int b, int* overflow) +{ + const int N = (int)(sizeof(ti_int) * CHAR_BIT); + const ti_int MIN = (ti_int)1 << (N-1); + const ti_int MAX = ~MIN; + *overflow = 0; + ti_int result = a * b; + if (a == MIN) + { + if (b != 0 && b != 1) + *overflow = 1; + return result; + } + if (b == MIN) + { + if (a != 0 && a != 1) + *overflow = 1; + return result; + } + ti_int sa = a >> (N - 1); + ti_int abs_a = (a ^ sa) - sa; + ti_int sb = b >> (N - 1); + ti_int abs_b = (b ^ sb) - sb; + if (abs_a < 2 || abs_b < 2) + return result; + if (sa == sb) + { + if (abs_a > MAX / abs_b) + *overflow = 1; + } + else + { + if (abs_a > MIN / -abs_b) + *overflow = 1; + } + return result; +} + +#endif diff --git a/contrib/compiler-rt/lib/mulsc3.c b/contrib/compiler-rt/lib/mulsc3.c index a878ba1..6d433fb 100644 --- a/contrib/compiler-rt/lib/mulsc3.c +++ b/contrib/compiler-rt/lib/mulsc3.c @@ -13,8 +13,7 @@ */ #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the product of a + ib and c + id */ @@ -28,46 +27,46 @@ __mulsc3(float __a, float __b, float __c, float __d) float _Complex z; __real__ z = __ac - __bd; __imag__ z = __ad + __bc; - if (isnan(__real__ z) && isnan(__imag__ z)) + if (crt_isnan(__real__ z) && crt_isnan(__imag__ z)) { int __recalc = 0; - if (isinf(__a) || isinf(__b)) + if (crt_isinf(__a) || crt_isinf(__b)) { - __a = copysignf(isinf(__a) ? 1 : 0, __a); - __b = copysignf(isinf(__b) ? 1 : 0, __b); - if (isnan(__c)) - __c = copysignf(0, __c); - if (isnan(__d)) - __d = copysignf(0, __d); + __a = crt_copysignf(crt_isinf(__a) ? 1 : 0, __a); + __b = crt_copysignf(crt_isinf(__b) ? 1 : 0, __b); + if (crt_isnan(__c)) + __c = crt_copysignf(0, __c); + if (crt_isnan(__d)) + __d = crt_copysignf(0, __d); __recalc = 1; } - if (isinf(__c) || isinf(__d)) + if (crt_isinf(__c) || crt_isinf(__d)) { - __c = copysignf(isinf(__c) ? 1 : 0, __c); - __d = copysignf(isinf(__d) ? 1 : 0, __d); - if (isnan(__a)) - __a = copysignf(0, __a); - if (isnan(__b)) - __b = copysignf(0, __b); + __c = crt_copysignf(crt_isinf(__c) ? 1 : 0, __c); + __d = crt_copysignf(crt_isinf(__d) ? 1 : 0, __d); + if (crt_isnan(__a)) + __a = crt_copysignf(0, __a); + if (crt_isnan(__b)) + __b = crt_copysignf(0, __b); __recalc = 1; } - if (!__recalc && (isinf(__ac) || isinf(__bd) || - isinf(__ad) || isinf(__bc))) + if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) || + crt_isinf(__ad) || crt_isinf(__bc))) { - if (isnan(__a)) - __a = copysignf(0, __a); - if (isnan(__b)) - __b = copysignf(0, __b); - if (isnan(__c)) - __c = copysignf(0, __c); - if (isnan(__d)) - __d = copysignf(0, __d); + if (crt_isnan(__a)) + __a = crt_copysignf(0, __a); + if (crt_isnan(__b)) + __b = crt_copysignf(0, __b); + if (crt_isnan(__c)) + __c = crt_copysignf(0, __c); + if (crt_isnan(__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; diff --git a/contrib/compiler-rt/lib/mulsf3.c b/contrib/compiler-rt/lib/mulsf3.c index bf46e14..fce2fd4 100644 --- a/contrib/compiler-rt/lib/mulsf3.c +++ b/contrib/compiler-rt/lib/mulsf3.c @@ -11,7 +11,6 @@ // with the IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/mulvdi3.c b/contrib/compiler-rt/lib/mulvdi3.c index fcbb5b3..bcc8e65 100644 --- a/contrib/compiler-rt/lib/mulvdi3.c +++ b/contrib/compiler-rt/lib/mulvdi3.c @@ -13,7 +13,6 @@ */ #include "int_lib.h" -#include <stdlib.h> /* Returns: a * b */ diff --git a/contrib/compiler-rt/lib/mulvsi3.c b/contrib/compiler-rt/lib/mulvsi3.c index 6271cd4..d372b201 100644 --- a/contrib/compiler-rt/lib/mulvsi3.c +++ b/contrib/compiler-rt/lib/mulvsi3.c @@ -13,7 +13,6 @@ */ #include "int_lib.h" -#include <stdlib.h> /* Returns: a * b */ diff --git a/contrib/compiler-rt/lib/mulvti3.c b/contrib/compiler-rt/lib/mulvti3.c index 7da9187..ae65cf8 100644 --- a/contrib/compiler-rt/lib/mulvti3.c +++ b/contrib/compiler-rt/lib/mulvti3.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <stdlib.h> /* Returns: a * b */ diff --git a/contrib/compiler-rt/lib/mulxc3.c b/contrib/compiler-rt/lib/mulxc3.c index b5ae865..cec0573 100644 --- a/contrib/compiler-rt/lib/mulxc3.c +++ b/contrib/compiler-rt/lib/mulxc3.c @@ -15,8 +15,7 @@ #if !_ARCH_PPC #include "int_lib.h" -#include <math.h> -#include <complex.h> +#include "int_math.h" /* Returns: the product of a + ib and c + id */ @@ -30,46 +29,46 @@ __mulxc3(long double __a, long double __b, long double __c, long double __d) long double _Complex z; __real__ z = __ac - __bd; __imag__ z = __ad + __bc; - if (isnan(__real__ z) && isnan(__imag__ z)) + if (crt_isnan(__real__ z) && crt_isnan(__imag__ z)) { int __recalc = 0; - if (isinf(__a) || isinf(__b)) + if (crt_isinf(__a) || crt_isinf(__b)) { - __a = copysignl(isinf(__a) ? 1 : 0, __a); - __b = copysignl(isinf(__b) ? 1 : 0, __b); - if (isnan(__c)) - __c = copysignl(0, __c); - if (isnan(__d)) - __d = copysignl(0, __d); + __a = crt_copysignl(crt_isinf(__a) ? 1 : 0, __a); + __b = crt_copysignl(crt_isinf(__b) ? 1 : 0, __b); + if (crt_isnan(__c)) + __c = crt_copysignl(0, __c); + if (crt_isnan(__d)) + __d = crt_copysignl(0, __d); __recalc = 1; } - if (isinf(__c) || isinf(__d)) + if (crt_isinf(__c) || crt_isinf(__d)) { - __c = copysignl(isinf(__c) ? 1 : 0, __c); - __d = copysignl(isinf(__d) ? 1 : 0, __d); - if (isnan(__a)) - __a = copysignl(0, __a); - if (isnan(__b)) - __b = copysignl(0, __b); + __c = crt_copysignl(crt_isinf(__c) ? 1 : 0, __c); + __d = crt_copysignl(crt_isinf(__d) ? 1 : 0, __d); + if (crt_isnan(__a)) + __a = crt_copysignl(0, __a); + if (crt_isnan(__b)) + __b = crt_copysignl(0, __b); __recalc = 1; } - if (!__recalc && (isinf(__ac) || isinf(__bd) || - isinf(__ad) || isinf(__bc))) + if (!__recalc && (crt_isinf(__ac) || crt_isinf(__bd) || + crt_isinf(__ad) || crt_isinf(__bc))) { - if (isnan(__a)) - __a = copysignl(0, __a); - if (isnan(__b)) - __b = copysignl(0, __b); - if (isnan(__c)) - __c = copysignl(0, __c); - if (isnan(__d)) - __d = copysignl(0, __d); + if (crt_isnan(__a)) + __a = crt_copysignl(0, __a); + if (crt_isnan(__b)) + __b = crt_copysignl(0, __b); + if (crt_isnan(__c)) + __c = crt_copysignl(0, __c); + if (crt_isnan(__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; diff --git a/contrib/compiler-rt/lib/negdf2.c b/contrib/compiler-rt/lib/negdf2.c index b47f397..b11b480 100644 --- a/contrib/compiler-rt/lib/negdf2.c +++ b/contrib/compiler-rt/lib/negdf2.c @@ -10,7 +10,6 @@ // This file implements double-precision soft-float negation. // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/negsf2.c b/contrib/compiler-rt/lib/negsf2.c index 98f9fc0..f8ef2d1 100644 --- a/contrib/compiler-rt/lib/negsf2.c +++ b/contrib/compiler-rt/lib/negsf2.c @@ -10,7 +10,6 @@ // This file implements single-precision soft-float negation. // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/negvdi2.c b/contrib/compiler-rt/lib/negvdi2.c index aafaa9d..e336ecf 100644 --- a/contrib/compiler-rt/lib/negvdi2.c +++ b/contrib/compiler-rt/lib/negvdi2.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: -a */ diff --git a/contrib/compiler-rt/lib/negvsi2.c b/contrib/compiler-rt/lib/negvsi2.c index 559ea18..b9e93fe 100644 --- a/contrib/compiler-rt/lib/negvsi2.c +++ b/contrib/compiler-rt/lib/negvsi2.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: -a */ diff --git a/contrib/compiler-rt/lib/negvti2.c b/contrib/compiler-rt/lib/negvti2.c index d931305..ef766bb 100644 --- a/contrib/compiler-rt/lib/negvti2.c +++ b/contrib/compiler-rt/lib/negvti2.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <stdlib.h> /* Returns: -a */ diff --git a/contrib/compiler-rt/lib/paritydi2.c b/contrib/compiler-rt/lib/paritydi2.c index e7bebf6..2ded54c 100644 --- a/contrib/compiler-rt/lib/paritydi2.c +++ b/contrib/compiler-rt/lib/paritydi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/paritysi2.c b/contrib/compiler-rt/lib/paritysi2.c index 64d509f..5999846 100644 --- a/contrib/compiler-rt/lib/paritysi2.c +++ b/contrib/compiler-rt/lib/paritysi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/popcountdi2.c b/contrib/compiler-rt/lib/popcountdi2.c index 136fc04..5e8a62f 100644 --- a/contrib/compiler-rt/lib/popcountdi2.c +++ b/contrib/compiler-rt/lib/popcountdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/popcountsi2.c b/contrib/compiler-rt/lib/popcountsi2.c index bfaa3ff..44544ff 100644 --- a/contrib/compiler-rt/lib/popcountsi2.c +++ b/contrib/compiler-rt/lib/popcountsi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/powidf2.c b/contrib/compiler-rt/lib/powidf2.c index 2e211eb..ac13b17 100644 --- a/contrib/compiler-rt/lib/powidf2.c +++ b/contrib/compiler-rt/lib/powidf2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/powisf2.c b/contrib/compiler-rt/lib/powisf2.c index e6b43b3..0c400ec 100644 --- a/contrib/compiler-rt/lib/powisf2.c +++ b/contrib/compiler-rt/lib/powisf2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/ppc/DD.h b/contrib/compiler-rt/lib/ppc/DD.h index 9ecd1f5..13862dc 100644 --- a/contrib/compiler-rt/lib/ppc/DD.h +++ b/contrib/compiler-rt/lib/ppc/DD.h @@ -1,7 +1,7 @@ #ifndef __DD_HEADER #define __DD_HEADER -#include <stdint.h> +#include "../int_lib.h" typedef union { long double ld; diff --git a/contrib/compiler-rt/lib/ppc/divtc3.c b/contrib/compiler-rt/lib/ppc/divtc3.c index d41f621..2991281 100644 --- a/contrib/compiler-rt/lib/ppc/divtc3.c +++ b/contrib/compiler-rt/lib/ppc/divtc3.c @@ -3,16 +3,16 @@ */ #include "DD.h" -#include <math.h> +#include "../int_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(isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \ - (x).s.lo = 0.0; \ - } +#define makeFinite(x) { \ + (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \ + (x).s.lo = 0.0; \ + } long double __gcc_qadd(long double, long double); long double __gcc_qsub(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.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 (isfinite(logbw)) + 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)); @@ -45,42 +45,45 @@ __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.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 (isnan(real.s.hi) && isnan(imag.s.hi)) + if (crt_isnan(real.s.hi) && crt_isnan(imag.s.hi)) { DD aDD = { .ld = a }; DD bDD = { .ld = b }; DD rDD = { .ld = denom }; - if ((rDD.s.hi == 0.0) && (!isnan(aDD.s.hi) || !isnan(bDD.s.hi))) + 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; } - else if ((isinf(aDD.s.hi) || isinf(bDD.s.hi)) && isfinite(cDD.s.hi) && isfinite(dDD.s.hi)) + else if ((crt_isinf(aDD.s.hi) || crt_isinf(bDD.s.hi)) && + crt_isfinite(cDD.s.hi) && crt_isfinite(dDD.s.hi)) { 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; } - else if ((isinf(cDD.s.hi) || isinf(dDD.s.hi)) && isfinite(aDD.s.hi) && isfinite(bDD.s.hi)) + else if ((crt_isinf(cDD.s.hi) || crt_isinf(dDD.s.hi)) && + crt_isfinite(aDD.s.hi) && crt_isfinite(bDD.s.hi)) { 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; } } diff --git a/contrib/compiler-rt/lib/ppc/fixtfdi.c b/contrib/compiler-rt/lib/ppc/fixtfdi.c index fa113a0..56e7b3f 100644 --- a/contrib/compiler-rt/lib/ppc/fixtfdi.c +++ b/contrib/compiler-rt/lib/ppc/fixtfdi.c @@ -7,7 +7,7 @@ */ #include "DD.h" -#include <stdint.h> +#include "../int_math.h" uint64_t __fixtfdi(long double input) { @@ -65,7 +65,7 @@ uint64_t __fixtfdi(long double input) /* 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. */ diff --git a/contrib/compiler-rt/lib/ppc/fixunstfdi.c b/contrib/compiler-rt/lib/ppc/fixunstfdi.c index 1fb5248..5e6e2ce 100644 --- a/contrib/compiler-rt/lib/ppc/fixunstfdi.c +++ b/contrib/compiler-rt/lib/ppc/fixunstfdi.c @@ -6,7 +6,6 @@ /* This file implements the PowerPC 128-bit double-double -> uint64_t conversion */ #include "DD.h" -#include <stdint.h> uint64_t __fixunstfdi(long double input) { diff --git a/contrib/compiler-rt/lib/ppc/floatditf.c b/contrib/compiler-rt/lib/ppc/floatditf.c index ed23dc8..beabdd0 100644 --- a/contrib/compiler-rt/lib/ppc/floatditf.c +++ b/contrib/compiler-rt/lib/ppc/floatditf.c @@ -6,7 +6,6 @@ /* This file implements the PowerPC long long -> long double conversion */ #include "DD.h" -#include <stdint.h> long double __floatditf(int64_t a) { diff --git a/contrib/compiler-rt/lib/ppc/floatunditf.c b/contrib/compiler-rt/lib/ppc/floatunditf.c index 20a3b71..b12e1e7 100644 --- a/contrib/compiler-rt/lib/ppc/floatunditf.c +++ b/contrib/compiler-rt/lib/ppc/floatunditf.c @@ -6,7 +6,6 @@ /* This file implements the PowerPC unsigned long long -> long double conversion */ #include "DD.h" -#include <stdint.h> long double __floatunditf(uint64_t a) { diff --git a/contrib/compiler-rt/lib/ppc/multc3.c b/contrib/compiler-rt/lib/ppc/multc3.c index 9d17a2c..738b65a 100644 --- a/contrib/compiler-rt/lib/ppc/multc3.c +++ b/contrib/compiler-rt/lib/ppc/multc3.c @@ -3,23 +3,19 @@ */ #include "DD.h" -#include <math.h> +#include "../int_math.h" -#if !defined(INFINITY) && defined(HUGE_VAL) -#define INFINITY HUGE_VAL -#endif /* INFINITY */ +#define makeFinite(x) { \ + (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \ + (x).s.lo = 0.0; \ + } -#define makeFinite(x) { \ - (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).s.hi)) { \ - (x).s.hi = __builtin_copysign(0.0, (x).s.hi); \ - (x).s.lo = 0.0; \ - } \ - } +#define zeroNaN(x) { \ + if (crt_isnan((x).s.hi)) { \ + (x).s.hi = crt_copysign(0.0, (x).s.hi); \ + (x).s.lo = 0.0; \ + } \ + } long double __gcc_qadd(long double, long double); long double __gcc_qsub(long double, long double); @@ -36,7 +32,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.s.hi) && isnan(imag.s.hi)) + if (crt_isnan(real.s.hi) && crt_isnan(imag.s.hi)) { int recalc = 0; @@ -45,7 +41,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.s.hi) || isinf(bDD.s.hi)) + if (crt_isinf(aDD.s.hi) || crt_isinf(bDD.s.hi)) { makeFinite(aDD); makeFinite(bDD); @@ -54,7 +50,7 @@ __multc3(long double a, long double b, long double c, long double d) recalc = 1; } - if (isinf(cDD.s.hi) || isinf(dDD.s.hi)) + if (crt_isinf(cDD.s.hi) || crt_isinf(dDD.s.hi)) { makeFinite(cDD); makeFinite(dDD); @@ -70,7 +66,8 @@ __multc3(long double a, long double b, long double c, long double d) DD adDD = { .ld = ad }; DD bcDD = { .ld = bc }; - if (isinf(acDD.s.hi) || isinf(bdDD.s.hi) || isinf(adDD.s.hi) || isinf(bcDD.s.hi)) + if (crt_isinf(acDD.s.hi) || crt_isinf(bdDD.s.hi) || + crt_isinf(adDD.s.hi) || crt_isinf(bcDD.s.hi)) { zeroNaN(aDD); zeroNaN(bDD); @@ -82,9 +79,9 @@ __multc3(long double a, long double b, long double c, long double d) 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; } } diff --git a/contrib/compiler-rt/lib/subdf3.c b/contrib/compiler-rt/lib/subdf3.c index 825e3c6..5eb1853 100644 --- a/contrib/compiler-rt/lib/subdf3.c +++ b/contrib/compiler-rt/lib/subdf3.c @@ -11,7 +11,6 @@ // IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// -#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/subsf3.c b/contrib/compiler-rt/lib/subsf3.c index 625376a..351be0ef 100644 --- a/contrib/compiler-rt/lib/subsf3.c +++ b/contrib/compiler-rt/lib/subsf3.c @@ -11,7 +11,6 @@ // IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// -#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" diff --git a/contrib/compiler-rt/lib/subvdi3.c b/contrib/compiler-rt/lib/subvdi3.c index 36b51ad..0f1f924 100644 --- a/contrib/compiler-rt/lib/subvdi3.c +++ b/contrib/compiler-rt/lib/subvdi3.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: a - b */ diff --git a/contrib/compiler-rt/lib/subvsi3.c b/contrib/compiler-rt/lib/subvsi3.c index 03983f7..ec4594c 100644 --- a/contrib/compiler-rt/lib/subvsi3.c +++ b/contrib/compiler-rt/lib/subvsi3.c @@ -11,10 +11,8 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" -#include <stdlib.h> /* Returns: a - b */ diff --git a/contrib/compiler-rt/lib/subvti3.c b/contrib/compiler-rt/lib/subvti3.c index 5d693dc..44127b7 100644 --- a/contrib/compiler-rt/lib/subvti3.c +++ b/contrib/compiler-rt/lib/subvti3.c @@ -15,7 +15,6 @@ #if __x86_64 #include "int_lib.h" -#include <stdlib.h> /* Returns: a - b */ diff --git a/contrib/compiler-rt/lib/trampoline_setup.c b/contrib/compiler-rt/lib/trampoline_setup.c index a22199e..2a22655 100644 --- a/contrib/compiler-rt/lib/trampoline_setup.c +++ b/contrib/compiler-rt/lib/trampoline_setup.c @@ -8,9 +8,6 @@ * ===----------------------------------------------------------------------=== */ -#include <stdint.h> -#include <stdlib.h> - #include "int_lib.h" extern void __clear_cache(void* start, void* end); diff --git a/contrib/compiler-rt/lib/truncdfsf2.c b/contrib/compiler-rt/lib/truncdfsf2.c index 1dbf02f..f57af7e 100644 --- a/contrib/compiler-rt/lib/truncdfsf2.c +++ b/contrib/compiler-rt/lib/truncdfsf2.c @@ -37,11 +37,7 @@ // //===----------------------------------------------------------------------===// -#include <stdint.h> -#include <limits.h> -#include <stdbool.h> - -#include "abi.h" +#include "int_lib.h" typedef double src_t; typedef uint64_t src_rep_t; diff --git a/contrib/compiler-rt/lib/ucmpdi2.c b/contrib/compiler-rt/lib/ucmpdi2.c index f2d3f99..3242bbf 100644 --- a/contrib/compiler-rt/lib/ucmpdi2.c +++ b/contrib/compiler-rt/lib/ucmpdi2.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/udivdi3.c b/contrib/compiler-rt/lib/udivdi3.c index bbd551a..6c0303d 100644 --- a/contrib/compiler-rt/lib/udivdi3.c +++ b/contrib/compiler-rt/lib/udivdi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/udivmoddi4.c b/contrib/compiler-rt/lib/udivmoddi4.c index c5db21c..73043d4 100644 --- a/contrib/compiler-rt/lib/udivmoddi4.c +++ b/contrib/compiler-rt/lib/udivmoddi4.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" @@ -133,7 +132,7 @@ __udivmoddi4(du_int a, du_int b, du_int* rem) *rem = n.s.low & (d.s.low - 1); if (d.s.low == 1) return n.all; - unsigned sr = __builtin_ctz(d.s.low); + 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; diff --git a/contrib/compiler-rt/lib/udivmodsi4.c b/contrib/compiler-rt/lib/udivmodsi4.c index 2a3ee27..5b49089 100644 --- a/contrib/compiler-rt/lib/udivmodsi4.c +++ b/contrib/compiler-rt/lib/udivmodsi4.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/udivmodti4.c b/contrib/compiler-rt/lib/udivmodti4.c index d1e19ed..427861b 100644 --- a/contrib/compiler-rt/lib/udivmodti4.c +++ b/contrib/compiler-rt/lib/udivmodti4.c @@ -132,7 +132,7 @@ __udivmodti4(tu_int a, tu_int b, tu_int* rem) *rem = n.s.low & (d.s.low - 1); if (d.s.low == 1) return n.all; - unsigned sr = __builtin_ctzll(d.s.low); + 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; diff --git a/contrib/compiler-rt/lib/udivsi3.c b/contrib/compiler-rt/lib/udivsi3.c index 721ae89..39ef48b 100644 --- a/contrib/compiler-rt/lib/udivsi3.c +++ b/contrib/compiler-rt/lib/udivsi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/umoddi3.c b/contrib/compiler-rt/lib/umoddi3.c index 9de1a64..3541ab6 100644 --- a/contrib/compiler-rt/lib/umoddi3.c +++ b/contrib/compiler-rt/lib/umoddi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/umodsi3.c b/contrib/compiler-rt/lib/umodsi3.c index 569b7fc..aae741d 100644 --- a/contrib/compiler-rt/lib/umodsi3.c +++ b/contrib/compiler-rt/lib/umodsi3.c @@ -11,7 +11,6 @@ * * ===----------------------------------------------------------------------=== */ -#include "abi.h" #include "int_lib.h" diff --git a/contrib/compiler-rt/lib/x86_64/floatdidf.c b/contrib/compiler-rt/lib/x86_64/floatdidf.c index cce3cd5..388404e 100644 --- a/contrib/compiler-rt/lib/x86_64/floatdidf.c +++ b/contrib/compiler-rt/lib/x86_64/floatdidf.c @@ -6,7 +6,7 @@ #ifdef __x86_64__ -#include <stdint.h> +#include "../int_lib.h" double __floatdidf(int64_t a) { diff --git a/contrib/compiler-rt/lib/x86_64/floatdisf.c b/contrib/compiler-rt/lib/x86_64/floatdisf.c index 753ba90..96c3728 100644 --- a/contrib/compiler-rt/lib/x86_64/floatdisf.c +++ b/contrib/compiler-rt/lib/x86_64/floatdisf.c @@ -4,7 +4,7 @@ #ifdef __x86_64__ -#include <stdint.h> +#include "../int_lib.h" float __floatdisf(int64_t a) { diff --git a/contrib/compiler-rt/lib/x86_64/floatdixf.c b/contrib/compiler-rt/lib/x86_64/floatdixf.c index 569f727..c01193a 100644 --- a/contrib/compiler-rt/lib/x86_64/floatdixf.c +++ b/contrib/compiler-rt/lib/x86_64/floatdixf.c @@ -6,7 +6,7 @@ #ifdef __x86_64__ -#include <stdint.h> +#include "../int_lib.h" long double __floatdixf(int64_t a) { |