diff --git a/lib/abi.h b/lib/abi.h new file mode 100644 index 000000000000..2534317ac8f6 --- /dev/null +++ b/lib/abi.h @@ -0,0 +1,23 @@ +/* ===------ 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/lib/absvdi2.c b/lib/absvdi2.c index 2ba6687daa85..9c5d4a299baa 100644 --- a/lib/absvdi2.c +++ b/lib/absvdi2.c @@ -11,6 +11,7 @@ * *===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if abs(x) < 0 */ -di_int +COMPILER_RT_ABI di_int __absvdi2(di_int a) { const int N = (int)(sizeof(di_int) * CHAR_BIT); diff --git a/lib/absvsi2.c b/lib/absvsi2.c index ec5cf69e878d..80a1a78984a8 100644 --- a/lib/absvsi2.c +++ b/lib/absvsi2.c @@ -10,7 +10,8 @@ * This file implements __absvsi2 for the compiler_rt library. * * ===----------------------------------------------------------------------=== - */ + */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if abs(x) < 0 */ -si_int +COMPILER_RT_ABI si_int __absvsi2(si_int a) { const int N = (int)(sizeof(si_int) * CHAR_BIT); diff --git a/lib/adddf3.c b/lib/adddf3.c index c40135613dd6..3cc997b71a3b 100644 --- a/lib/adddf3.c +++ b/lib/adddf3.c @@ -1,4 +1,4 @@ -//===-- lib/adddf3.c - Double-precision addition and subtraction --*- C -*-===// +//===-- lib/adddf3.c - Double-precision addition ------------------*- C -*-===// // // The LLVM Compiler Infrastructure // @@ -7,15 +7,20 @@ // //===----------------------------------------------------------------------===// // -// This file implements double-precision soft-float addition and subtraction -// with the IEEE-754 default rounding (to nearest, ties to even). +// This file implements double-precision soft-float addition with the IEEE-754 +// default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" + #define DOUBLE_PRECISION #include "fp_lib.h" -fp_t __adddf3(fp_t a, fp_t b) { +ARM_EABI_FNALIAS(dadd, adddf3); + +COMPILER_RT_ABI fp_t +__adddf3(fp_t a, fp_t b) { rep_t aRep = toRep(a); rep_t bRep = toRep(b); @@ -147,8 +152,3 @@ fp_t __adddf3(fp_t a, fp_t b) { if (roundGuardSticky == 0x4) result += result & 1; return fromRep(result); } - -// Subtraction; flip the sign bit of b and add. -fp_t __subdf3(fp_t a, fp_t b) { - return __adddf3(a, fromRep(toRep(b) ^ signBit)); -} diff --git a/lib/addsf3.c b/lib/addsf3.c index c0e8d8e70dc8..20610ef31fa2 100644 --- a/lib/addsf3.c +++ b/lib/addsf3.c @@ -1,4 +1,4 @@ -//===-- lib/addsf3.c - Single-precision addition and subtraction --*- C -*-===// +//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===// // // The LLVM Compiler Infrastructure // @@ -7,14 +7,18 @@ // //===----------------------------------------------------------------------===// // -// This file implements single-precision soft-float addition and subtraction -// with the IEEE-754 default rounding (to nearest, ties to even). +// This file implements single-precision soft-float addition with the IEEE-754 +// default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" + #define SINGLE_PRECISION #include "fp_lib.h" +ARM_EABI_FNALIAS(fadd, addsf3); + fp_t __addsf3(fp_t a, fp_t b) { rep_t aRep = toRep(a); @@ -147,18 +151,3 @@ fp_t __addsf3(fp_t a, fp_t b) { if (roundGuardSticky == 0x4) result += result & 1; return fromRep(result); } - -// Subtraction; flip the sign bit of b and add. -fp_t __subsf3(fp_t a, fp_t b) { - return __addsf3(a, fromRep(toRep(b) ^ signBit)); -} - - - - - - - - - - diff --git a/lib/addvdi3.c b/lib/addvdi3.c index ded023e07296..51ad397f5710 100644 --- a/lib/addvdi3.c +++ b/lib/addvdi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a + b overflows */ -di_int +COMPILER_RT_ABI di_int __addvdi3(di_int a, di_int b) { di_int s = a + b; diff --git a/lib/addvsi3.c b/lib/addvsi3.c index 7bdb39b97fe5..c18f7bd45986 100644 --- a/lib/addvsi3.c +++ b/lib/addvsi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a + b overflows */ -si_int +COMPILER_RT_ABI si_int __addvsi3(si_int a, si_int b) { si_int s = a + b; diff --git a/lib/apple_versioning.c b/lib/apple_versioning.c index bb6302fbb4d0..e838d726fbb6 100644 --- a/lib/apple_versioning.c +++ b/lib/apple_versioning.c @@ -143,6 +143,147 @@ 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; diff --git a/lib/arm/divmodsi4.S b/lib/arm/divmodsi4.S new file mode 100644 index 000000000000..cec39a7926f9 --- /dev/null +++ b/lib/arm/divmodsi4.S @@ -0,0 +1,47 @@ +/*===-- divmodsi4.S - 32-bit signed integer divide and modulus ------------===// + * + * 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 the __divmodsi4 (32-bit signed integer divide and + * modulus) function for the ARM architecture. A naive digit-by-digit + * computation is employed for simplicity. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r4-r7, lr} ;\ + add r7, sp, #12 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4-r7, pc} + +.syntax unified +.align 3 +DEFINE_COMPILERRT_FUNCTION(__divmodsi4) + ESTABLISH_FRAME +// Set aside the sign of the quotient and modulus, and the address for the +// modulus. + eor r4, r0, r1 + mov r5, r0 + mov r6, r2 +// Take the absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). + eor ip, r0, r0, asr #31 + eor lr, r1, r1, asr #31 + sub r0, ip, r0, asr #31 + sub r1, lr, r1, asr #31 +// Unsigned divmod: + bl SYMBOL_NAME(__udivmodsi4) +// Apply the sign of quotient and modulus + ldr r1, [r6] + eor r0, r0, r4, asr #31 + eor r1, r1, r5, asr #31 + sub r0, r0, r4, asr #31 + sub r1, r1, r5, asr #31 + str r1, [r6] + CLEAR_FRAME_AND_RETURN diff --git a/lib/arm/divsi3.S b/lib/arm/divsi3.S new file mode 100644 index 000000000000..00e61815ab4f --- /dev/null +++ b/lib/arm/divsi3.S @@ -0,0 +1,41 @@ +/*===-- divsi3.S - 32-bit signed integer divide ---------------------------===// + * + * 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 the __divsi3 (32-bit signed integer divide) function + * for the ARM architecture as a wrapper around the unsigned routine. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r4, r7, lr} ;\ + add r7, sp, #4 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4, r7, pc} + +.syntax unified +.align 3 +// Ok, APCS and AAPCS agree on 32 bit args, so it's safe to use the same routine. +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv, __divsi3) +DEFINE_COMPILERRT_FUNCTION(__divsi3) + ESTABLISH_FRAME +// Set aside the sign of the quotient. + eor r4, r0, r1 +// Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). + eor r2, r0, r0, asr #31 + eor r3, r1, r1, asr #31 + sub r0, r2, r0, asr #31 + sub r1, r3, r1, asr #31 +// abs(a) / abs(b) + bl SYMBOL_NAME(__udivsi3) +// Apply sign of quotient to result and return. + eor r0, r0, r4, asr #31 + sub r0, r0, r4, asr #31 + CLEAR_FRAME_AND_RETURN diff --git a/lib/arm/modsi3.S b/lib/arm/modsi3.S index 40ba856e3551..a4cd2ee54e7b 100644 --- a/lib/arm/modsi3.S +++ b/lib/arm/modsi3.S @@ -1,36 +1,39 @@ -//===-------- modsi3.S - Implement modsi3 ---------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// +/*===-- modsi3.S - 32-bit signed integer modulus --------------------------===// + * + * 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 the __modsi3 (32-bit signed integer modulus) function + * for the ARM architecture as a wrapper around the unsigned routine. + * + *===----------------------------------------------------------------------===*/ #include "../assembly.h" -// -// extern int32_t __modsi3(int32_t a, int32_t b); -// -// Returns the remainder when dividing two 32-bit signed integers. -// Conceptually, the function is: { return a - (a / b) * b; } -// But if you write that in C, llvm compiles it to a call to __modsi3... -// - .align 2 +#define ESTABLISH_FRAME \ + push {r4, r7, lr} ;\ + add r7, sp, #4 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4, r7, pc} + +.syntax unified +.align 3 DEFINE_COMPILERRT_FUNCTION(__modsi3) - push {r4, r5, r7, lr} - add r7, sp, #8 // set stack frame - mov r5, r0 // save a - mov r4, r1 // save b - bl ___divsi3 // compute a/b -#if __ARM_ARCH_7A__ - mls r0, r4, r0, r5 // mulitple result * b and subtract from a -#else - // before armv7, does not have "mls" instruction - mul r3, r0, r4 // multiple result * b - sub r0, r5, r3 // a - result -#endif - pop {r4, r5, r7, pc} - - - + ESTABLISH_FRAME + // Set aside the sign of the dividend. + mov r4, r0 + // Take absolute value of a and b via abs(x) = (x^(x >> 31)) - (x >> 31). + eor r2, r0, r0, asr #31 + eor r3, r1, r1, asr #31 + sub r0, r2, r0, asr #31 + sub r1, r3, r1, asr #31 + // abs(a) % abs(b) + bl SYMBOL_NAME(__umodsi3) + // Apply sign of dividend to result and return. + eor r0, r0, r4, asr #31 + sub r0, r0, r4, asr #31 + CLEAR_FRAME_AND_RETURN diff --git a/lib/arm/udivmodsi4.S b/lib/arm/udivmodsi4.S new file mode 100644 index 000000000000..d164a751d089 --- /dev/null +++ b/lib/arm/udivmodsi4.S @@ -0,0 +1,80 @@ +/*===-- udivmodsi4.S - 32-bit unsigned integer divide and modulus ---------===// + * + * 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 the __udivmodsi4 (32-bit unsigned integer divide and + * modulus) function for the ARM architecture. A naive digit-by-digit + * computation is employed for simplicity. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r4, r7, lr} ;\ + add r7, sp, #4 +#define CLEAR_FRAME_AND_RETURN \ + pop {r4, r7, pc} + +#define a r0 +#define b r1 +#define i r3 +#define r r4 +#define q ip +#define one lr + +.syntax unified +.align 3 +DEFINE_COMPILERRT_FUNCTION(__udivmodsi4) +// We use a simple digit by digit algorithm; before we get into the actual +// divide loop, we must calculate the left-shift amount necessary to align +// the MSB of the divisor with that of the dividend (If this shift is +// negative, then the result is zero, and we early out). We also conjure a +// bit mask of 1 to use in constructing the quotient, and initialize the +// quotient to zero. + ESTABLISH_FRAME + clz r4, a + tst b, b // detect divide-by-zero + clz r3, b + mov q, #0 + beq LOCAL_LABEL(return) // return 0 if b is zero. + mov one, #1 + subs i, r3, r4 + blt LOCAL_LABEL(return) // return 0 if MSB(a) < MSB(b) + +LOCAL_LABEL(mainLoop): +// This loop basically implements the following: +// +// do { +// if (a >= b << i) { +// a -= b << i; +// q |= 1 << i; +// if (a == 0) break; +// } +// } while (--i) +// +// Note that this does not perform the final iteration (i == 0); by doing it +// this way, we can merge the two branches which is a substantial win for +// such a tight loop on current ARM architectures. + subs r, a, b, lsl i + orrhs q, q,one, lsl i + movhs a, r + subsne i, i, #1 + bhi LOCAL_LABEL(mainLoop) + +// Do the final test subtraction and update of quotient (i == 0), as it is +// not performed in the main loop. + subs r, a, b + orrhs q, #1 + movhs a, r + +LOCAL_LABEL(return): +// Store the remainder, and move the quotient to r0, then return. + str a, [r2] + mov r0, q + CLEAR_FRAME_AND_RETURN diff --git a/lib/arm/udivsi3.S b/lib/arm/udivsi3.S new file mode 100644 index 000000000000..6d8966539c7f --- /dev/null +++ b/lib/arm/udivsi3.S @@ -0,0 +1,80 @@ +/*===-- udivsi3.S - 32-bit unsigned integer divide ------------------------===// + * + * 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 the __udivsi3 (32-bit unsigned integer divide) + * function for the ARM architecture. A naive digit-by-digit computation is + * employed for simplicity. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define ESTABLISH_FRAME \ + push {r7, lr} ;\ + mov r7, sp +#define CLEAR_FRAME_AND_RETURN \ + pop {r7, pc} + +#define a r0 +#define b r1 +#define r r2 +#define i r3 +#define q ip +#define one lr + +.syntax unified +.align 3 +// Ok, APCS and AAPCS agree on 32 bit args, so it's safe to use the same routine. +DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidiv, __udivsi3) +DEFINE_COMPILERRT_FUNCTION(__udivsi3) +// We use a simple digit by digit algorithm; before we get into the actual +// divide loop, we must calculate the left-shift amount necessary to align +// the MSB of the divisor with that of the dividend (If this shift is +// negative, then the result is zero, and we early out). We also conjure a +// bit mask of 1 to use in constructing the quotient, and initialize the +// quotient to zero. + ESTABLISH_FRAME + clz r2, a + tst b, b // detect divide-by-zero + clz r3, b + mov q, #0 + beq LOCAL_LABEL(return) // return 0 if b is zero. + mov one, #1 + subs i, r3, r2 + blt LOCAL_LABEL(return) // return 0 if MSB(a) < MSB(b) + +LOCAL_LABEL(mainLoop): +// This loop basically implements the following: +// +// do { +// if (a >= b << i) { +// a -= b << i; +// q |= 1 << i; +// if (a == 0) break; +// } +// } while (--i) +// +// Note that this does not perform the final iteration (i == 0); by doing it +// this way, we can merge the two branches which is a substantial win for +// such a tight loop on current ARM architectures. + subs r, a, b, lsl i + orrhs q, q,one, lsl i + movhs a, r + subsne i, i, #1 + bhi LOCAL_LABEL(mainLoop) + +// Do the final test subtraction and update of quotient (i == 0), as it is +// not performed in the main loop. + subs r, a, b + orrhs q, #1 + +LOCAL_LABEL(return): +// Move the quotient to r0 and return. + mov r0, q + CLEAR_FRAME_AND_RETURN diff --git a/lib/arm/umodsi3.S b/lib/arm/umodsi3.S new file mode 100644 index 000000000000..3a2ab2b87751 --- /dev/null +++ b/lib/arm/umodsi3.S @@ -0,0 +1,58 @@ +/*===-- umodsi3.S - 32-bit unsigned integer modulus -----------------------===// + * + * 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 the __umodsi3 (32-bit unsigned integer modulus) + * function for the ARM architecture. A naive digit-by-digit computation is + * employed for simplicity. + * + *===----------------------------------------------------------------------===*/ + +#include "../assembly.h" + +#define a r0 +#define b r1 +#define r r2 +#define i r3 + +.syntax unified +.align 3 +DEFINE_COMPILERRT_FUNCTION(__umodsi3) +// We use a simple digit by digit algorithm; before we get into the actual +// divide loop, we must calculate the left-shift amount necessary to align +// the MSB of the divisor with that of the dividend. + clz r2, a + tst b, b // detect b == 0 + clz r3, b + bxeq lr // return a if b == 0 + subs i, r3, r2 + bxlt lr // return a if MSB(a) < MSB(b) + +LOCAL_LABEL(mainLoop): +// This loop basically implements the following: +// +// do { +// if (a >= b << i) { +// a -= b << i; +// if (a == 0) break; +// } +// } while (--i) +// +// Note that this does not perform the final iteration (i == 0); by doing it +// this way, we can merge the two branches which is a substantial win for +// such a tight loop on current ARM architectures. + subs r, a, b, lsl i + movhs a, r + subsne i, i, #1 + bhi LOCAL_LABEL(mainLoop) + +// Do the final test subtraction and update of remainder (i == 0), as it is +// not performed in the main loop. + subs r, a, b + movhs a, r + bx lr diff --git a/lib/ashldi3.c b/lib/ashldi3.c index 1067e6fc61c0..adce4e2cb755 100644 --- a/lib/ashldi3.c +++ b/lib/ashldi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,9 @@ /* Precondition: 0 <= b < bits_in_dword */ -di_int +ARM_EABI_FNALIAS(llsl, ashldi3); + +COMPILER_RT_ABI di_int __ashldi3(di_int a, si_int b) { const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); diff --git a/lib/ashrdi3.c b/lib/ashrdi3.c index 94d46f1b4622..03692a31d823 100644 --- a/lib/ashrdi3.c +++ b/lib/ashrdi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,9 @@ /* Precondition: 0 <= b < bits_in_dword */ -di_int +ARM_EABI_FNALIAS(lasr, ashrdi3); + +COMPILER_RT_ABI di_int __ashrdi3(di_int a, si_int b) { const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); diff --git a/lib/assembly.h b/lib/assembly.h index 41c24d74ead3..0ce83ac294c8 100644 --- a/lib/assembly.h +++ b/lib/assembly.h @@ -22,33 +22,48 @@ #define SEPARATOR ; #endif -/* We can't use __USER_LABEL_PREFIX__ here, it isn't possible to concatenate the - *values* of two macros. This is quite brittle, though. */ #if defined(__APPLE__) -#define SYMBOL_NAME(name) _##name +#define HIDDEN_DIRECTIVE .private_extern +#define LOCAL_LABEL(name) L_##name #else -#define SYMBOL_NAME(name) name +#define HIDDEN_DIRECTIVE .hidden +#define LOCAL_LABEL(name) .L_##name #endif +#define GLUE2(a, b) a ## b +#define GLUE(a, b) GLUE2(a, b) +#define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) + #ifdef VISIBILITY_HIDDEN -#define DEFINE_COMPILERRT_FUNCTION(name) \ - .globl SYMBOL_NAME(name) SEPARATOR \ - .private_extern SYMBOL_NAME(name) SEPARATOR \ +#define DEFINE_COMPILERRT_FUNCTION(name) \ + .globl SYMBOL_NAME(name) SEPARATOR \ + HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \ SYMBOL_NAME(name): #else -#define DEFINE_COMPILERRT_FUNCTION(name) \ - .globl SYMBOL_NAME(name) SEPARATOR \ +#define DEFINE_COMPILERRT_FUNCTION(name) \ + .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_NAME(name): #endif -#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ - .globl SYMBOL_NAME(name) SEPARATOR \ - .private_extern SYMBOL_NAME(name) SEPARATOR \ +#define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ + .globl SYMBOL_NAME(name) SEPARATOR \ + HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR \ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \ - .globl name SEPARATOR \ - .private_extern name SEPARATOR \ + .globl name SEPARATOR \ + HIDDEN_DIRECTIVE name SEPARATOR \ name: +#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \ + .globl SYMBOL_NAME(name) SEPARATOR \ + .set SYMBOL_NAME(name), SYMBOL_NAME(target) SEPARATOR + +#if defined (__ARM_EABI__) +# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) \ + DEFINE_COMPILERRT_FUNCTION_ALIAS(aeabi_name, name) +#else +# define DEFINE_AEABI_FUNCTION_ALIAS(aeabi_name, name) +#endif + #endif /* COMPILERRT_ASSEMBLY_H */ diff --git a/lib/clzdi2.c b/lib/clzdi2.c index 213277712acc..c281945ffdff 100644 --- a/lib/clzdi2.c +++ b/lib/clzdi2.c @@ -1,6 +1,6 @@ /* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------=== * - * The LLVM Compiler Infrastructure + * 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. @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,7 @@ /* Precondition: a != 0 */ -si_int +COMPILER_RT_ABI si_int __clzdi2(di_int a) { dwords x; diff --git a/lib/clzsi2.c b/lib/clzsi2.c index d99047dec485..d0a6aeabcb32 100644 --- a/lib/clzsi2.c +++ b/lib/clzsi2.c @@ -1,6 +1,6 @@ /* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------=== * - * The LLVM Compiler Infrastructure + * 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. @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,7 @@ /* Precondition: a != 0 */ -si_int +COMPILER_RT_ABI si_int __clzsi2(si_int a) { su_int x = (su_int)a; diff --git a/lib/cmpdi2.c b/lib/cmpdi2.c index 04bd7cf62461..999c3d2a662f 100644 --- a/lib/cmpdi2.c +++ b/lib/cmpdi2.c @@ -6,20 +6,21 @@ * Source Licenses. See LICENSE.TXT for details. * * ===----------------------------------------------------------------------=== - * + * * This file implements __cmpdi2 for the compiler_rt library. * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -/* Returns: if (a < b) returns 0 +/* Returns: if (a < b) returns 0 * if (a == b) returns 1 * if (a > b) returns 2 */ -si_int +COMPILER_RT_ABI si_int __cmpdi2(di_int a, di_int b) { dwords x; diff --git a/lib/ctzdi2.c b/lib/ctzdi2.c index f7ae50fdf09e..b3d37d01b0c6 100644 --- a/lib/ctzdi2.c +++ b/lib/ctzdi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,7 @@ /* Precondition: a != 0 */ -si_int +COMPILER_RT_ABI si_int __ctzdi2(di_int a) { dwords x; diff --git a/lib/ctzsi2.c b/lib/ctzsi2.c index 0c738fa591cc..2ff0e5d7655f 100644 --- a/lib/ctzsi2.c +++ b/lib/ctzsi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,7 @@ /* Precondition: a != 0 */ -si_int +COMPILER_RT_ABI si_int __ctzsi2(si_int a) { su_int x = (su_int)a; diff --git a/lib/divdf3.c b/lib/divdf3.c index 217d284bf814..925abd509e12 100644 --- a/lib/divdf3.c +++ b/lib/divdf3.c @@ -15,10 +15,13 @@ // underflow with correct rounding. // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" +ARM_EABI_FNALIAS(ddiv, divdf3); + fp_t __divdf3(fp_t a, fp_t b) { const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; diff --git a/lib/divdi3.c b/lib/divdi3.c index a1b83ea3ecec..d62df56f6783 100644 --- a/lib/divdi3.c +++ b/lib/divdi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +du_int COMPILER_RT_ABI __udivmoddi4(du_int a, du_int b, du_int* rem); /* Returns: a / b */ -di_int +COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b) { const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1; diff --git a/lib/divmoddi4.c b/lib/divmoddi4.c new file mode 100644 index 000000000000..d3ca745ac695 --- /dev/null +++ b/lib/divmoddi4.c @@ -0,0 +1,30 @@ +/*===-- divmoddi4.c - Implement __divmoddi4 --------------------------------=== + * + * 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 __divmoddi4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ +#include "abi.h" + +#include "int_lib.h" + +extern COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); + +ARM_EABI_FNALIAS(ldivmod, divmoddi4); + +/* Returns: a / b, *rem = a % b */ + +COMPILER_RT_ABI di_int +__divmoddi4(di_int a, di_int b, di_int* rem) +{ + di_int d = __divdi3(a,b); + *rem = a - (d*b); + return d; +} diff --git a/lib/divmodsi4.c b/lib/divmodsi4.c index 2ec3dd4a7e5a..4dc1978282a4 100644 --- a/lib/divmodsi4.c +++ b/lib/divmodsi4.c @@ -11,15 +11,16 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -extern si_int __divsi3(si_int a, si_int b); +extern COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b); /* Returns: a / b, *rem = a % b */ -si_int +COMPILER_RT_ABI si_int __divmodsi4(si_int a, si_int b, si_int* rem) { si_int d = __divsi3(a,b); diff --git a/lib/divsf3.c b/lib/divsf3.c index b798cfb03c0d..b73330793a08 100644 --- a/lib/divsf3.c +++ b/lib/divsf3.c @@ -15,10 +15,13 @@ // underflow with correct rounding. // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" +ARM_EABI_FNALIAS(fdiv, divsf3); + fp_t __divsf3(fp_t a, fp_t b) { const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; diff --git a/lib/divsi3.c b/lib/divsi3.c index c48ecf45dbc1..01ef27473004 100644 --- a/lib/divsi3.c +++ b/lib/divsi3.c @@ -11,14 +11,17 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -su_int __udivsi3(su_int n, su_int d); +su_int COMPILER_RT_ABI __udivsi3(su_int n, su_int d); /* Returns: a / b */ -si_int +ARM_EABI_FNALIAS(idiv, divsi3); + +COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b) { const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1; diff --git a/lib/extendsfdf2.c b/lib/extendsfdf2.c index db65acf97b28..c0b628dffcdd 100644 --- a/lib/extendsfdf2.c +++ b/lib/extendsfdf2.c @@ -41,6 +41,8 @@ #include #include +#include "abi.h" + typedef float src_t; typedef uint32_t src_rep_t; #define SRC_REP_C UINT32_C @@ -67,6 +69,8 @@ static inline dst_t dstFromRep(dst_rep_t x) { // End helper routines. Conversion implementation follows. +ARM_EABI_FNALIAS(f2d, extendsfdf2); + dst_t __extendsfdf2(src_t a) { // Various constants whose values follow from the type parameters. diff --git a/lib/ffsdi2.c b/lib/ffsdi2.c index 8a1c68cb3234..89f1b7bf478a 100644 --- a/lib/ffsdi2.c +++ b/lib/ffsdi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,7 @@ * the value zero if a is zero. The least significant bit is index one. */ -si_int +COMPILER_RT_ABI si_int __ffsdi2(di_int a) { dwords x; diff --git a/lib/fixdfdi.c b/lib/fixdfdi.c index 3a760ff24977..85a456d11229 100644 --- a/lib/fixdfdi.c +++ b/lib/fixdfdi.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -23,6 +24,8 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ +ARM_EABI_FNALIAS(d2lz, fixdfdi); + di_int __fixdfdi(double a) { diff --git a/lib/fixdfsi.c b/lib/fixdfsi.c index 98062abce4bb..fbcf1470b719 100644 --- a/lib/fixdfsi.c +++ b/lib/fixdfsi.c @@ -12,10 +12,15 @@ // conversion is undefined for out of range values in the C standard. // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" +#include "int_lib.h" + +ARM_EABI_FNALIAS(d2iz, fixdfsi); + int __fixdfsi(fp_t a) { // Break a into sign, exponent, significand diff --git a/lib/fixsfdi.c b/lib/fixsfdi.c index 1a85306520b2..d80e33eb74c5 100644 --- a/lib/fixsfdi.c +++ b/lib/fixsfdi.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -23,7 +24,9 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -di_int +ARM_EABI_FNALIAS(d2lz, fixsfdi); + +COMPILER_RT_ABI di_int __fixsfdi(float a) { float_bits fb; diff --git a/lib/fixsfsi.c b/lib/fixsfsi.c index b68471d7c6ba..67749a56778d 100644 --- a/lib/fixsfsi.c +++ b/lib/fixsfsi.c @@ -12,12 +12,15 @@ // conversion is undefined for out of range values in the C standard. // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" -int __fixsfsi(fp_t a) { - +ARM_EABI_FNALIAS(f2iz, fixsfsi); + +COMPILER_RT_ABI int +__fixsfsi(fp_t a) { // Break a into sign, exponent, significand const rep_t aRep = toRep(a); const rep_t aAbs = aRep & absMask; diff --git a/lib/fixunsdfdi.c b/lib/fixunsdfdi.c index 1c78e2bb136a..d80b84a8d669 100644 --- a/lib/fixunsdfdi.c +++ b/lib/fixunsdfdi.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -26,7 +27,9 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ -du_int +ARM_EABI_FNALIAS(d2ulz, fixunsdfdi); + +COMPILER_RT_ABI du_int __fixunsdfdi(double a) { double_bits fb; diff --git a/lib/fixunsdfsi.c b/lib/fixunsdfsi.c index e0298915660f..ecdfb5d622e6 100644 --- a/lib/fixunsdfsi.c +++ b/lib/fixunsdfsi.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -26,7 +27,9 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ -su_int +ARM_EABI_FNALIAS(d2uiz, fixunsdfsi); + +COMPILER_RT_ABI su_int __fixunsdfsi(double a) { double_bits fb; diff --git a/lib/fixunssfdi.c b/lib/fixunssfdi.c index 3b1bc4af948f..150642045bdc 100644 --- a/lib/fixunssfdi.c +++ b/lib/fixunssfdi.c @@ -11,9 +11,9 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" - /* Returns: convert a to a unsigned long long, rounding toward zero. * Negative values all become zero. */ @@ -26,7 +26,9 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -du_int +ARM_EABI_FNALIAS(f2ulz, fixunssfdi); + +COMPILER_RT_ABI du_int __fixunssfdi(float a) { float_bits fb; diff --git a/lib/fixunssfsi.c b/lib/fixunssfsi.c index 023d7b2445d5..dbaa5115b2ba 100644 --- a/lib/fixunssfsi.c +++ b/lib/fixunssfsi.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -26,7 +27,9 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -su_int +ARM_EABI_FNALIAS(f2uiz, fixunssfsi); + +COMPILER_RT_ABI su_int __fixunssfsi(float a) { float_bits fb; diff --git a/lib/floatdidf.c b/lib/floatdidf.c index cad354a57fc9..5ba952635030 100644 --- a/lib/floatdidf.c +++ b/lib/floatdidf.c @@ -11,6 +11,7 @@ * *===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -23,13 +24,15 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ +ARM_EABI_FNALIAS(l2d, floatdidf); + #ifndef __SOFT_FP__ /* Support for systems that have hardware floating-point; we'll set the inexact flag * as a side-effect of this computation. */ #include -double +COMPILER_RT_ABI double __floatdidf(di_int a) { static const double twop52 = 0x1.0p52; @@ -49,7 +52,7 @@ __floatdidf(di_int a) * set, and we don't want to code-gen to an unknown soft-float implementation. */ -double +COMPILER_RT_ABI double __floatdidf(di_int a) { if (a == 0) diff --git a/lib/floatdisf.c b/lib/floatdisf.c index 71d603b568f7..4dc13cab4778 100644 --- a/lib/floatdisf.c +++ b/lib/floatdisf.c @@ -12,7 +12,7 @@ *===----------------------------------------------------------------------=== */ -#include "int_lib.h" +#include "abi.h" #include /* Returns: convert a to a float, rounding toward even.*/ @@ -23,7 +23,11 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -float +#include "int_lib.h" + +ARM_EABI_FNALIAS(l2f, floatdisf); + +COMPILER_RT_ABI float __floatdisf(di_int a) { if (a == 0) diff --git a/lib/floatsidf.c b/lib/floatsidf.c index 85facea1632c..72273353ac55 100644 --- a/lib/floatsidf.c +++ b/lib/floatsidf.c @@ -12,10 +12,15 @@ // mode. // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" +#include "int_lib.h" + +ARM_EABI_FNALIAS(i2d, floatsidf); + fp_t __floatsidf(int a) { const int aWidth = sizeof a * CHAR_BIT; diff --git a/lib/floatsisf.c b/lib/floatsisf.c index d1bb46076477..e5250ffd6021 100644 --- a/lib/floatsisf.c +++ b/lib/floatsisf.c @@ -12,10 +12,15 @@ // mode. // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" +#include "int_lib.h" + +ARM_EABI_FNALIAS(i2f, floatsisf); + fp_t __floatsisf(int a) { const int aWidth = sizeof a * CHAR_BIT; diff --git a/lib/floatundidf.c b/lib/floatundidf.c index 506fc3c4be7b..e74e9d8d2fdd 100644 --- a/lib/floatundidf.c +++ b/lib/floatundidf.c @@ -12,7 +12,7 @@ * ===----------------------------------------------------------------------=== */ -#include "int_lib.h" +#include "abi.h" #include /* Returns: convert a to a double, rounding toward even. */ @@ -23,6 +23,10 @@ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ +#include "int_lib.h" + +ARM_EABI_FNALIAS(ul2d, floatundidf); + #ifndef __SOFT_FP__ /* Support for systems that have hardware floating-point; we'll set the inexact flag * as a side-effect of this computation. @@ -30,7 +34,7 @@ #include -double +COMPILER_RT_ABI double __floatundidf(du_int a) { static const double twop52 = 0x1.0p52; @@ -52,7 +56,7 @@ __floatundidf(du_int a) * set, and we don't want to code-gen to an unknown soft-float implementation. */ -double +COMPILER_RT_ABI double __floatundidf(du_int a) { if (a == 0) diff --git a/lib/floatundisf.c b/lib/floatundisf.c index 55e40230ecb3..eea45a745949 100644 --- a/lib/floatundisf.c +++ b/lib/floatundisf.c @@ -12,7 +12,7 @@ *===----------------------------------------------------------------------=== */ -#include "int_lib.h" +#include "abi.h" #include /* Returns: convert a to a float, rounding toward even. */ @@ -23,7 +23,11 @@ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ -float +#include "int_lib.h" + +ARM_EABI_FNALIAS(ul2f, floatundisf); + +COMPILER_RT_ABI float __floatundisf(du_int a) { if (a == 0) diff --git a/lib/floatunsidf.c b/lib/floatunsidf.c index 0f473aa1aadd..37562996a41b 100644 --- a/lib/floatunsidf.c +++ b/lib/floatunsidf.c @@ -12,10 +12,15 @@ // mode. // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" +#include "int_lib.h" + +ARM_EABI_FNALIAS(ui2d, floatunsidf); + fp_t __floatunsidf(unsigned int a) { const int aWidth = sizeof a * CHAR_BIT; diff --git a/lib/floatunsisf.c b/lib/floatunsisf.c index 48eff93a2fc3..14ef10307f79 100644 --- a/lib/floatunsisf.c +++ b/lib/floatunsisf.c @@ -12,10 +12,15 @@ // mode. // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" +#include "int_lib.h" + +ARM_EABI_FNALIAS(ui2f, floatunsisf); + fp_t __floatunsisf(unsigned int a) { const int aWidth = sizeof a * CHAR_BIT; diff --git a/lib/lshrdi3.c b/lib/lshrdi3.c index 84525b78a1a8..911edb191422 100644 --- a/lib/lshrdi3.c +++ b/lib/lshrdi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,9 @@ /* Precondition: 0 <= b < bits_in_dword */ -di_int +ARM_EABI_FNALIAS(llsr, lshrdi3); + +COMPILER_RT_ABI di_int __lshrdi3(di_int a, si_int b) { const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); diff --git a/lib/moddi3.c b/lib/moddi3.c index 3b350ddc3fb9..af0a80832aef 100644 --- a/lib/moddi3.c +++ b/lib/moddi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem); /* Returns: a % b */ -di_int +COMPILER_RT_ABI di_int __moddi3(di_int a, di_int b) { const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1; diff --git a/lib/modsi3.c b/lib/modsi3.c index 70d38a6b5d59..05ce806f7105 100644 --- a/lib/modsi3.c +++ b/lib/modsi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -su_int __divsi3(si_int a, si_int b); +su_int COMPILER_RT_ABI __divsi3(si_int a, si_int b); /* Returns: a % b */ -si_int +COMPILER_RT_ABI si_int __modsi3(si_int a, si_int b) { return a - __divsi3(a, b) * b; diff --git a/lib/muldf3.c b/lib/muldf3.c index 85672e584436..f402cfb39d38 100644 --- a/lib/muldf3.c +++ b/lib/muldf3.c @@ -11,11 +11,15 @@ // with the IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" -fp_t __muldf3(fp_t a, fp_t b) { +ARM_EABI_FNALIAS(dmul, muldf3); + +COMPILER_RT_ABI fp_t +__muldf3(fp_t a, fp_t b) { const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; const unsigned int bExponent = toRep(b) >> significandBits & maxExponent; diff --git a/lib/muldi3.c b/lib/muldi3.c index 43637324bae8..e6322bf5df82 100644 --- a/lib/muldi3.c +++ b/lib/muldi3.c @@ -10,7 +10,8 @@ * This file implements __muldi3 for the compiler_rt library. * * ===----------------------------------------------------------------------=== - */ + */ +#include "abi.h" #include "int_lib.h" @@ -40,7 +41,9 @@ __muldsi3(su_int a, su_int b) /* Returns: a * b */ -di_int +ARM_EABI_FNALIAS(lmul, muldi3); + +COMPILER_RT_ABI di_int __muldi3(di_int a, di_int b) { dwords x; diff --git a/lib/mulsf3.c b/lib/mulsf3.c index dd4ce11a0897..bf46e148167b 100644 --- a/lib/mulsf3.c +++ b/lib/mulsf3.c @@ -11,11 +11,15 @@ // with the IEEE-754 default rounding (to nearest, ties to even). // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" -fp_t __mulsf3(fp_t a, fp_t b) { +ARM_EABI_FNALIAS(fmul, mulsf3); + +COMPILER_RT_ABI fp_t +__mulsf3(fp_t a, fp_t b) { const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; const unsigned int bExponent = toRep(b) >> significandBits & maxExponent; diff --git a/lib/negdf2.c b/lib/negdf2.c index aeae2e8a344c..b47f3978b41e 100644 --- a/lib/negdf2.c +++ b/lib/negdf2.c @@ -10,10 +10,13 @@ // This file implements double-precision soft-float negation. // //===----------------------------------------------------------------------===// +#include "abi.h" #define DOUBLE_PRECISION #include "fp_lib.h" +ARM_EABI_FNALIAS(dneg, negdf2); + fp_t __negdf2(fp_t a) { return fromRep(toRep(a) ^ signBit); } diff --git a/lib/negsf2.c b/lib/negsf2.c index d211f7cc89b2..98f9fc0c0a3a 100644 --- a/lib/negsf2.c +++ b/lib/negsf2.c @@ -10,10 +10,14 @@ // This file implements single-precision soft-float negation. // //===----------------------------------------------------------------------===// +#include "abi.h" #define SINGLE_PRECISION #include "fp_lib.h" -fp_t __negsf2(fp_t a) { +ARM_EABI_FNALIAS(fneg, negsf2); + +COMPILER_RT_ABI fp_t +__negsf2(fp_t a) { return fromRep(toRep(a) ^ signBit); } diff --git a/lib/negvdi2.c b/lib/negvdi2.c index 2851d26f4798..aafaa9dc5ea3 100644 --- a/lib/negvdi2.c +++ b/lib/negvdi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if -a overflows */ -di_int +COMPILER_RT_ABI di_int __negvdi2(di_int a) { const di_int MIN = (di_int)1 << ((int)(sizeof(di_int) * CHAR_BIT)-1); diff --git a/lib/negvsi2.c b/lib/negvsi2.c index 1a8334760595..559ea18e48b4 100644 --- a/lib/negvsi2.c +++ b/lib/negvsi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if -a overflows */ -si_int +COMPILER_RT_ABI si_int __negvsi2(si_int a) { const si_int MIN = (si_int)1 << ((int)(sizeof(si_int) * CHAR_BIT)-1); diff --git a/lib/paritydi2.c b/lib/paritydi2.c index 9d349b8c2416..e7bebf68524b 100644 --- a/lib/paritydi2.c +++ b/lib/paritydi2.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: 1 if number of bits is odd else returns 0 */ -si_int __paritysi2(si_int a); +si_int COMPILER_RT_ABI __paritysi2(si_int a); -si_int +COMPILER_RT_ABI si_int __paritydi2(di_int a) { dwords x; diff --git a/lib/paritysi2.c b/lib/paritysi2.c index 76de328e1eab..64d509fa7954 100644 --- a/lib/paritysi2.c +++ b/lib/paritysi2.c @@ -11,12 +11,13 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: 1 if number of bits is odd else returns 0 */ -si_int +COMPILER_RT_ABI si_int __paritysi2(si_int a) { su_int x = (su_int)a; diff --git a/lib/popcountdi2.c b/lib/popcountdi2.c index 0778a66c81df..136fc0486fd0 100644 --- a/lib/popcountdi2.c +++ b/lib/popcountdi2.c @@ -11,12 +11,13 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: count of 1 bits */ -si_int +COMPILER_RT_ABI si_int __popcountdi2(di_int a) { du_int x2 = (du_int)a; diff --git a/lib/popcountsi2.c b/lib/popcountsi2.c index e425b0b86388..bfaa3fff2ee4 100644 --- a/lib/popcountsi2.c +++ b/lib/popcountsi2.c @@ -11,12 +11,13 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: count of 1 bits */ -si_int +COMPILER_RT_ABI si_int __popcountsi2(si_int a) { su_int x = (su_int)a; diff --git a/lib/powidf2.c b/lib/powidf2.c index 0200e1eab0b5..2e211eb3dcb8 100644 --- a/lib/powidf2.c +++ b/lib/powidf2.c @@ -11,12 +11,13 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: a ^ b */ -double +COMPILER_RT_ABI double __powidf2(double a, si_int b) { const int recip = b < 0; diff --git a/lib/powisf2.c b/lib/powisf2.c index c834b9696954..e6b43b3a3cc4 100644 --- a/lib/powisf2.c +++ b/lib/powisf2.c @@ -11,12 +11,13 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: a ^ b */ -float +COMPILER_RT_ABI float __powisf2(float a, si_int b) { const int recip = b < 0; diff --git a/lib/subdf3.c b/lib/subdf3.c new file mode 100644 index 000000000000..825e3c662973 --- /dev/null +++ b/lib/subdf3.c @@ -0,0 +1,30 @@ +//===-- lib/adddf3.c - Double-precision subtraction ---------------*- C -*-===// +// +// 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 double-precision soft-float subtraction with the +// IEEE-754 default rounding (to nearest, ties to even). +// +//===----------------------------------------------------------------------===// +#include "abi.h" + +#define DOUBLE_PRECISION +#include "fp_lib.h" + +fp_t COMPILER_RT_ABI __adddf3(fp_t a, fp_t b); + + +ARM_EABI_FNALIAS(dsub, subdf3); + +// Subtraction; flip the sign bit of b and add. +COMPILER_RT_ABI fp_t +__subdf3(fp_t a, fp_t b) { + return __adddf3(a, fromRep(toRep(b) ^ signBit)); +} + +/* FIXME: rsub for ARM EABI */ diff --git a/lib/subsf3.c b/lib/subsf3.c new file mode 100644 index 000000000000..625376acc376 --- /dev/null +++ b/lib/subsf3.c @@ -0,0 +1,29 @@ +//===-- lib/subsf3.c - Single-precision subtraction ---------------*- C -*-===// +// +// 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 single-precision soft-float subtraction with the +// IEEE-754 default rounding (to nearest, ties to even). +// +//===----------------------------------------------------------------------===// +#include "abi.h" + +#define SINGLE_PRECISION +#include "fp_lib.h" + +fp_t COMPILER_RT_ABI __addsf3(fp_t a, fp_t b); + +ARM_EABI_FNALIAS(fsub, subsf3); + +// Subtraction; flip the sign bit of b and add. +COMPILER_RT_ABI fp_t +__subsf3(fp_t a, fp_t b) { + return __addsf3(a, fromRep(toRep(b) ^ signBit)); +} + +/* FIXME: rsub for ARM EABI */ diff --git a/lib/subvdi3.c b/lib/subvdi3.c index 17f55d00059e..36b51ad979ac 100644 --- a/lib/subvdi3.c +++ b/lib/subvdi3.c @@ -1,6 +1,6 @@ /* ===-- subvdi3.c - Implement __subvdi3 -----------------------------------=== * - * The LLVM Compiler Infrastructure + * 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. @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a - b overflows */ -di_int +COMPILER_RT_ABI di_int __subvdi3(di_int a, di_int b) { di_int s = a - b; diff --git a/lib/subvsi3.c b/lib/subvsi3.c index 51bb454475aa..03983f747e49 100644 --- a/lib/subvsi3.c +++ b/lib/subvsi3.c @@ -1,6 +1,6 @@ /* ===-- subvsi3.c - Implement __subvsi3 -----------------------------------=== * - * The LLVM Compiler Infrastructure + * 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. @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" #include @@ -19,7 +20,7 @@ /* Effects: aborts if a - b overflows */ -si_int +COMPILER_RT_ABI si_int __subvsi3(si_int a, si_int b) { si_int s = a - b; diff --git a/lib/truncdfsf2.c b/lib/truncdfsf2.c index 92609fb784c9..1dbf02f5ef63 100644 --- a/lib/truncdfsf2.c +++ b/lib/truncdfsf2.c @@ -41,6 +41,8 @@ #include #include +#include "abi.h" + typedef double src_t; typedef uint64_t src_rep_t; #define SRC_REP_C UINT64_C @@ -66,7 +68,10 @@ static inline dst_t dstFromRep(dst_rep_t x) { // End helper routines. Conversion implementation follows. -dst_t __truncdfsf2(src_t a) { +ARM_EABI_FNALIAS(d2f, truncdfsf2); + +COMPILER_RT_ABI dst_t +__truncdfsf2(src_t a) { // Various constants whose values follow from the type parameters. // Any reasonable optimizer will fold and propagate all of these. diff --git a/lib/ucmpdi2.c b/lib/ucmpdi2.c index ead726723aa5..f2d3f99f880e 100644 --- a/lib/ucmpdi2.c +++ b/lib/ucmpdi2.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -19,7 +20,7 @@ * if (a > b) returns 2 */ -si_int +COMPILER_RT_ABI si_int __ucmpdi2(du_int a, du_int b) { udwords x; diff --git a/lib/udivdi3.c b/lib/udivdi3.c index 642f2fb9c251..bbd551ac7111 100644 --- a/lib/udivdi3.c +++ b/lib/udivdi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +du_int COMPILER_RT_ABI __udivmoddi4(du_int a, du_int b, du_int* rem); /* Returns: a / b */ -du_int +COMPILER_RT_ABI du_int __udivdi3(du_int a, du_int b) { return __udivmoddi4(a, b, 0); diff --git a/lib/udivmoddi4.c b/lib/udivmoddi4.c index 693736fb8cd2..c5db21cf0c89 100644 --- a/lib/udivmoddi4.c +++ b/lib/udivmoddi4.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -20,7 +21,9 @@ /* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */ -du_int +ARM_EABI_FNALIAS(uldivmod, udivmoddi4); + +COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem) { const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT; diff --git a/lib/udivmodsi4.c b/lib/udivmodsi4.c index 38b5bd43de67..2a3ee27f8dcf 100644 --- a/lib/udivmodsi4.c +++ b/lib/udivmodsi4.c @@ -11,20 +11,21 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -extern su_int __udivsi3(su_int n, su_int d); +extern su_int COMPILER_RT_ABI __udivsi3(su_int n, su_int d); /* Returns: a / b, *rem = a % b */ -su_int +COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem) { si_int d = __udivsi3(a,b); *rem = a - (d*b); - return d; + return d; } diff --git a/lib/udivsi3.c b/lib/udivsi3.c index 476f2bc310b9..721ae89e4bfc 100644 --- a/lib/udivsi3.c +++ b/lib/udivsi3.c @@ -11,6 +11,7 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" @@ -18,7 +19,9 @@ /* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */ -su_int +ARM_EABI_FNALIAS(uidiv, udivsi3); + +COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d) { const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT; diff --git a/lib/umoddi3.c b/lib/umoddi3.c index adb4b0e75dff..9de1a64fdad1 100644 --- a/lib/umoddi3.c +++ b/lib/umoddi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" -du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +du_int COMPILER_RT_ABI __udivmoddi4(du_int a, du_int b, du_int* rem); /* Returns: a % b */ -du_int +COMPILER_RT_ABI du_int __umoddi3(du_int a, du_int b) { du_int r; diff --git a/lib/umodsi3.c b/lib/umodsi3.c index d3aaaeae0008..569b7fcb1685 100644 --- a/lib/umodsi3.c +++ b/lib/umodsi3.c @@ -11,14 +11,15 @@ * * ===----------------------------------------------------------------------=== */ +#include "abi.h" #include "int_lib.h" /* Returns: a % b */ -su_int __udivsi3(su_int a, su_int b); +su_int COMPILER_RT_ABI __udivsi3(su_int a, su_int b); -su_int +COMPILER_RT_ABI su_int __umodsi3(su_int a, su_int b) { return a - __udivsi3(a, b) * b; diff --git a/make/AppleBI.mk b/make/AppleBI.mk index 184c16ad84e9..0e3473d516c2 100644 --- a/make/AppleBI.mk +++ b/make/AppleBI.mk @@ -19,8 +19,8 @@ else INSTALL_TARGET = install-iOS CFLAGS.Release.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) CFLAGS.Release.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) - CFLAGS.Static.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) - CFLAGS.Static.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) + CFLAGS.Static.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) -static + CFLAGS.Static.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) -static LD_OTHER_FLAGS = -Wl,-alias_list,$(SRCROOT)/lib/arm/softfloat-alias.list -isysroot $(SDKROOT) endif @@ -43,7 +43,11 @@ installsrc: install: $(INSTALL_TARGET) # Copy results to DSTROOT. -install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib +install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib \ + $(SYMROOT)/libcompiler_rt-dyld.a + mkdir -p $(DSTROOT)/usr/local/lib/dyld + cp $(SYMROOT)/libcompiler_rt-dyld.a \ + $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a mkdir -p $(DSTROOT)/usr/lib/system strip -S $(SYMROOT)/libcompiler_rt.dylib \ -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib @@ -70,10 +74,14 @@ $(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(RC_ARCHS), \ # Copy results to DSTROOT. install-iOS: $(SYMROOT)/libcompiler_rt-static.a \ + $(SYMROOT)/libcompiler_rt-dyld.a \ $(SYMROOT)/libcompiler_rt.dylib mkdir -p $(DSTROOT)/usr/local/lib cp $(SYMROOT)/libcompiler_rt-static.a \ $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a + mkdir -p $(DSTROOT)/usr/local/lib/dyld + cp $(SYMROOT)/libcompiler_rt-dyld.a \ + $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a mkdir -p $(DSTROOT)/usr/lib/system strip -S $(SYMROOT)/libcompiler_rt.dylib \ -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib @@ -84,3 +92,16 @@ $(SYMROOT)/libcompiler_rt-static.a : $(foreach arch,$(RC_ARCHS), \ $(OBJROOT)/darwin_bni/Static/$(arch)/libcompiler_rt.a) lipo -create $^ -o $@ +# rule to make each archive slice for dyld +$(OBJROOT)/libcompiler_rt-dyld-%.a : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a + cp $^ $@ + ar -d $@ apple_versioning.o + ar -d $@ gcc_personality_v0.o + ar -d $@ eprintf.o + ranlib $@ + +# rule to make make archive for dyld +$(SYMROOT)/libcompiler_rt-dyld.a : $(foreach arch,$(RC_ARCHS), \ + $(OBJROOT)/libcompiler_rt-dyld-$(arch).a) + lipo -create $^ -o $@ + diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk index a29793991ebb..6eb10c82267b 100644 --- a/make/platform/clang_darwin.mk +++ b/make/platform/clang_darwin.mk @@ -6,6 +6,20 @@ Description := Static runtime libraries for clang/Darwin. +# A function that ensures we don't try to build for architectures that we +# don't have working toolchains for. +CheckArches = \ + $(shell \ + result=""; \ + for arch in $(1); do \ + if $(CC) -arch $$arch -dumpversion > /dev/null; then \ + result="$$result$$arch "; \ + fi; \ + done; \ + echo $$result) + +### + Configs := UniversalArchs := @@ -13,22 +27,23 @@ UniversalArchs := # still be referenced from Darwin system headers. This symbol is only ever # needed on i386. Configs += eprintf -UniversalArchs.eprintf := i386 +UniversalArchs.eprintf := $(call CheckArches,i386) # Configuration for targetting 10.4. We need a few functions missing from # libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really # support targetting PowerPC. Configs += 10.4 -UniversalArchs.10.4 := i386 x86_64 +UniversalArchs.10.4 := $(call CheckArches,i386 x86_64) -# Configuration for targetting armv6. We need a few additional functions which -# must be in the same linkage unit. -Configs += armv6 -UniversalArchs.armv6 := armv6 +# Configuration for targetting iOS, for some ARMv6 functions, which must be +# in the same linkage unit, and for a couple of other functions that didn't +# make it into libSystem. +Configs += ios +UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv6 armv7) # Configuration for use with kernel/kexts. Configs += cc_kext -UniversalArchs.cc_kext := armv6 armv7 i386 x86_64 +UniversalArchs.cc_kext := $(call CheckArches,armv6 armv7 i386 x86_64) ### @@ -40,10 +55,42 @@ override CC := $(patsubst -arch_%,,$(CC)) CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer +# Always set deployment target arguments for every build, these libraries should +# never depend on the environmental overrides. We simply set them to minimum +# supported deployment target -- nothing in the compiler-rt libraries should +# actually depend on the deployment target. +X86_DEPLOYMENT_ARGS := -mmacosx-version-min=10.4 +ARM_DEPLOYMENT_ARGS := -miphoneos-version-min=1.0 + +# If an explicit ARM_SDK build variable is set, use that as the isysroot. +ifneq ($(ARM_SDK),) +ARM_DEPLOYMENT_ARGS += -isysroot $(ARM_SDK) +endif + +CFLAGS.eprintf := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.10.4 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.ios.i386 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.ios.x86_64 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.ios.armv6 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) +CFLAGS.ios.armv7 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.i386 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.x86_64 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.armv6 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -mthumb +CFLAGS.cc_kext.armv7 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -mthumb + FUNCTIONS.eprintf := eprintf FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf -FUNCTIONS.armv6 := switch16 switch32 switch8 switchu8 \ - save_vfp_d8_d15_regs restore_vfp_d8_d15_regs + +FUNCTIONS.ios := divmodsi4 udivmodsi4 +# On x86, the divmod functions reference divsi. +FUNCTIONS.ios.i386 := $(FUNCTIONS.ios) \ + divsi3 udivsi3 +FUNCTIONS.ios.x86_64 := $(FUNCTIONS.ios) \ + divsi3 udivsi3 +FUNCTIONS.ios.armv6 := $(FUNCTIONS.ios) \ + sync_synchronize \ + switch16 switch32 switch8 switchu8 \ + save_vfp_d8_d15_regs restore_vfp_d8_d15_regs CCKEXT_COMMON_FUNCTIONS := \ absvdi2 \ @@ -62,6 +109,8 @@ CCKEXT_COMMON_FUNCTIONS := \ divdc3 \ divdi3 \ divsc3 \ + divmodsi4 \ + udivmodsi4 \ do_global_dtors \ eprintf \ ffsdi2 \ @@ -135,10 +184,8 @@ CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ floatsisf \ floatunsidf \ floatunsisf \ - gtdf2 \ - gtsf2 \ - ltdf2 \ - ltsf2 \ + comparedf2 \ + comparesf2 \ modsi3 \ muldf3 \ mulsf3 \ @@ -159,9 +206,6 @@ CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ FUNCTIONS.cc_kext.armv6 := $(CCKEXT_ARM_FUNCTIONS) FUNCTIONS.cc_kext.armv7 := $(CCKEXT_ARM_FUNCTIONS) -CFLAGS.cc_kext.armv6 := $(CFLAGS) -mthumb -CFLAGS.cc_kext.armv7 := $(CFLAGS) -mthumb - CCKEXT_X86_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ divxc3 \ fixunsxfdi \ @@ -221,11 +265,9 @@ FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \ # FIXME: Currently, compiler-rt is missing implementations for a number of the # functions that need to go into libcc_kext.a. Filter them out for now. CCKEXT_MISSING_FUNCTIONS := \ - adddf3 addsf3 cmpdf2 cmpsf2 div0 divdf3 divsf3 \ - extendsfdf2 ffssi2 fixdfsi fixsfsi floatsidf floatsisf \ - floatunsidf floatunsisf gtdf2 gtsf2 ltdf2 ltsf2 \ - muldf3 mulsf3 negdf2 negsf2 subdf3 subsf3 \ - truncdfsf2 udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ + cmpdf2 cmpsf2 div0 \ + ffssi2 \ + udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ bswapsi2 \ gcc_bcmp \ do_global_dtors \ diff --git a/make/platform/darwin_bni.mk b/make/platform/darwin_bni.mk index f15334f31943..14a1c197ec45 100644 --- a/make/platform/darwin_bni.mk +++ b/make/platform/darwin_bni.mk @@ -9,6 +9,8 @@ Configs := Debug Release Profile Static UniversalArchs := $(RC_ARCHS) ifeq (,$(SDKROOT)) + CC.Release := $(CC) + CC.Static := $(CC) else CC.Release := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc CC.Static := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc diff --git a/test/Unit/absvti2_test.c b/test/Unit/absvti2_test.c index 0a1db6a5650e..8233c18ff09a 100644 --- a/test/Unit/absvti2_test.c +++ b/test/Unit/absvti2_test.c @@ -77,6 +77,8 @@ int main() if (test__absvti2(make_ti(((ti_int)rand() << 32) | rand(), ((ti_int)rand() << 32) | rand()))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/adddf3vfp_test.c b/test/Unit/adddf3vfp_test.c index 6ead2341abf1..5ad42f7b3a6e 100644 --- a/test/Unit/adddf3vfp_test.c +++ b/test/Unit/adddf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__adddf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/addsf3vfp_test.c b/test/Unit/addsf3vfp_test.c index ddfe39f96272..95e057c36305 100644 --- a/test/Unit/addsf3vfp_test.c +++ b/test/Unit/addsf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__addsf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/addvti3_test.c b/test/Unit/addvti3_test.c index 33cfbc98529b..1cf066c48917 100644 --- a/test/Unit/addvti3_test.c +++ b/test/Unit/addvti3_test.c @@ -87,6 +87,8 @@ int main() make_ti(0x7FFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ashlti3_test.c b/test/Unit/ashlti3_test.c index 4b6c6ca0164b..b9f4dcc0a8c7 100644 --- a/test/Unit/ashlti3_test.c +++ b/test/Unit/ashlti3_test.c @@ -168,6 +168,8 @@ int main() if (test__ashlti3(make_ti(0xFEDCBA9876543215LL, 0xFEDCBA9876543215LL), 127, make_ti(0x8000000000000000LL, 0x0000000000000000LL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ashrti3_test.c b/test/Unit/ashrti3_test.c index bfa34cbe9675..3abee36b6b7d 100644 --- a/test/Unit/ashrti3_test.c +++ b/test/Unit/ashrti3_test.c @@ -166,6 +166,8 @@ int main() if (test__ashrti3(make_ti(0xFEDCBA9876543215LL, 0xFEDCBA9876543215LL), 127, make_ti(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/bswapdi2_test.c b/test/Unit/bswapdi2_test.c index 634c2f9b1d47..2d830cf5e41e 100644 --- a/test/Unit/bswapdi2_test.c +++ b/test/Unit/bswapdi2_test.c @@ -37,6 +37,8 @@ int main() return 1; if (test__bswapdi2(0x0000000100000002LL, 0x0200000001000000LL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/bswapsi2_test.c b/test/Unit/bswapsi2_test.c index 4fb756008b47..4488a888e1eb 100644 --- a/test/Unit/bswapsi2_test.c +++ b/test/Unit/bswapsi2_test.c @@ -37,6 +37,8 @@ int main() return 1; if (test__bswapsi2(0x00000001, 0x01000000)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/clzti2_test.c b/test/Unit/clzti2_test.c index 668c790b4d5a..d2ca1645dd1a 100644 --- a/test/Unit/clzti2_test.c +++ b/test/Unit/clzti2_test.c @@ -83,6 +83,8 @@ int main() return 1; if (test__clzti2(make_ti(0x8000000100000000LL, 0x8000000800000000LL), 0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/cmpti2_test.c b/test/Unit/cmpti2_test.c index 2f5828ededa9..4339e0abb5e9 100644 --- a/test/Unit/cmpti2_test.c +++ b/test/Unit/cmpti2_test.c @@ -105,6 +105,8 @@ int main() if (test__cmpti2(make_ti(2, 2), make_ti(2, 3), 0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ctzti2_test.c b/test/Unit/ctzti2_test.c index 485a88d70a98..c4934bd254b7 100644 --- a/test/Unit/ctzti2_test.c +++ b/test/Unit/ctzti2_test.c @@ -76,6 +76,8 @@ int main() return 1; if (test__ctzti2(make_ti(0x8000000000000000LL, 0x0000000000000000LL), 127)) return 1; +#else + printf("skipped\n"); #endif return 0; diff --git a/test/Unit/divdf3vfp_test.c b/test/Unit/divdf3vfp_test.c index ce5b25858113..e13822ffcaa0 100644 --- a/test/Unit/divdf3vfp_test.c +++ b/test/Unit/divdf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__divdf3vfp(10.0, -2.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/divsf3vfp_test.c b/test/Unit/divsf3vfp_test.c index 6248ca0c66ee..8382558412cf 100644 --- a/test/Unit/divsf3vfp_test.c +++ b/test/Unit/divsf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__divsf3vfp(10.0, -2.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/divtc3_test.c b/test/Unit/divtc3_test.c index 815c10bcd062..7bb74d755146 100644 --- a/test/Unit/divtc3_test.c +++ b/test/Unit/divtc3_test.c @@ -375,6 +375,8 @@ int main() // printf("No errors found.\n"); +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/divti3_test.c b/test/Unit/divti3_test.c index c9eceedd40ca..7c8e2970fa6e 100644 --- a/test/Unit/divti3_test.c +++ b/test/Unit/divti3_test.c @@ -71,6 +71,8 @@ int main() if (test__divti3(make_ti(0x8000000000000000LL, 0), 2, make_ti(0xC000000000000000LL, 0))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/divxc3_test.c b/test/Unit/divxc3_test.c index c93db67d875e..aa8a7625d139 100644 --- a/test/Unit/divxc3_test.c +++ b/test/Unit/divxc3_test.c @@ -372,6 +372,8 @@ int main() } } +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/eqdf2vfp_test.c b/test/Unit/eqdf2vfp_test.c index 6babd249858d..585bd08e9789 100644 --- a/test/Unit/eqdf2vfp_test.c +++ b/test/Unit/eqdf2vfp_test.c @@ -48,6 +48,8 @@ int main() return 1; if (test__eqdf2vfp(1.0, HUGE_VAL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/eqsf2vfp_test.c b/test/Unit/eqsf2vfp_test.c index 4a292bc2151c..b0eed9402a37 100644 --- a/test/Unit/eqsf2vfp_test.c +++ b/test/Unit/eqsf2vfp_test.c @@ -44,6 +44,8 @@ int main() return 1; if (test__eqsf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/extebdsfdf2vfp_test.c b/test/Unit/extebdsfdf2vfp_test.c index 9bbe5729ed3f..3a009cf2d7f8 100644 --- a/test/Unit/extebdsfdf2vfp_test.c +++ b/test/Unit/extebdsfdf2vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__extendsfdf2vfp(3.1415926535)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ffsti2_test.c b/test/Unit/ffsti2_test.c index b679ab20fe71..fcb5c2725f26 100644 --- a/test/Unit/ffsti2_test.c +++ b/test/Unit/ffsti2_test.c @@ -76,6 +76,8 @@ int main() if (test__ffsti2(make_ti(0x8000000000000000uLL, 0), 128)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixdfsivfp_test.c b/test/Unit/fixdfsivfp_test.c index a9f012c44414..c6102e274ee5 100644 --- a/test/Unit/fixdfsivfp_test.c +++ b/test/Unit/fixdfsivfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__fixdfsivfp(-2147483648.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixdfti_test.c b/test/Unit/fixdfti_test.c index 5ea33172d682..98a5628edddf 100644 --- a/test/Unit/fixdfti_test.c +++ b/test/Unit/fixdfti_test.c @@ -116,6 +116,8 @@ int main() if (test__fixdfti(-0x1.FFFFFFFFFFFFEp+126, make_ti(0x8000000000000800LL, 0))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixsfsivfp_test.c b/test/Unit/fixsfsivfp_test.c index c10152255b48..9abf5e856476 100644 --- a/test/Unit/fixsfsivfp_test.c +++ b/test/Unit/fixsfsivfp_test.c @@ -45,6 +45,8 @@ int main() return 1; if (test__fixsfsivfp(65536.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixsfti_test.c b/test/Unit/fixsfti_test.c index 325659e0eb92..5fdd00578528 100644 --- a/test/Unit/fixsfti_test.c +++ b/test/Unit/fixsfti_test.c @@ -104,6 +104,8 @@ int main() if (test__fixsfti(-0x1.FFFFFCp+126F, make_ti(0x8000010000000000LL, 0))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixunsdfsivfp_test.c b/test/Unit/fixunsdfsivfp_test.c index 991506f8ac12..3727cf7b02fb 100644 --- a/test/Unit/fixunsdfsivfp_test.c +++ b/test/Unit/fixunsdfsivfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__fixunsdfsivfp(65536.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixunssfsivfp_test.c b/test/Unit/fixunssfsivfp_test.c index 08e0e8ee9bcb..c8e45f408b63 100644 --- a/test/Unit/fixunssfsivfp_test.c +++ b/test/Unit/fixunssfsivfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__fixunssfsivfp(65536.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixunstfdi_test.c b/test/Unit/fixunstfdi_test.c index a7cc9be2fcfc..d0a5db7a9c97 100644 --- a/test/Unit/fixunstfdi_test.c +++ b/test/Unit/fixunstfdi_test.c @@ -114,6 +114,8 @@ int main() if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixunsxfdi_test.c b/test/Unit/fixunsxfdi_test.c index 6d0f8d3fb65a..4308f6f4ef1f 100644 --- a/test/Unit/fixunsxfdi_test.c +++ b/test/Unit/fixunsxfdi_test.c @@ -117,6 +117,8 @@ int main() if (test__fixunsxfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixunsxfti_test.c b/test/Unit/fixunsxfti_test.c index f1f6087009d9..0e3c842bc022 100644 --- a/test/Unit/fixunsxfti_test.c +++ b/test/Unit/fixunsxfti_test.c @@ -134,6 +134,8 @@ int main() if (test__fixunsxfti(0x1.FFFFFFFFFFFFFFF8p+126L, make_ti(0x7FFFFFFFFFFFFFFELL, 0))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixxfdi_test.c b/test/Unit/fixxfdi_test.c index 1facd36494d0..43ac0f8aaa3c 100644 --- a/test/Unit/fixxfdi_test.c +++ b/test/Unit/fixxfdi_test.c @@ -108,6 +108,8 @@ int main() if (test__fixxfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0x8000000000000002LL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/fixxfti_test.c b/test/Unit/fixxfti_test.c index 85c15a20c2ca..11296b036871 100644 --- a/test/Unit/fixxfti_test.c +++ b/test/Unit/fixxfti_test.c @@ -139,6 +139,8 @@ int main() if (test__fixxfti(-0x1.FFFFFFFFFFFFFFFCp+126L, make_ti(0x8000000000000001LL, 0x0000000000000000LL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatdixf_test.c b/test/Unit/floatdixf_test.c index 8d049fdb8984..337666426318 100644 --- a/test/Unit/floatdixf_test.c +++ b/test/Unit/floatdixf_test.c @@ -137,6 +137,8 @@ int main() if (test__floatdixf(0x023479FD0E092DE0LL, 0x1.1A3CFE870496Fp+57)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatsidfvfp_test.c b/test/Unit/floatsidfvfp_test.c index 79e87b3211c1..e21ecda59945 100644 --- a/test/Unit/floatsidfvfp_test.c +++ b/test/Unit/floatsidfvfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__floatsidfvfp(0x80000000)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatsisfvfp_test.c b/test/Unit/floatsisfvfp_test.c index 00f4ac298d3f..d20905bd91e3 100644 --- a/test/Unit/floatsisfvfp_test.c +++ b/test/Unit/floatsisfvfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__floatsisfvfp(0x80000000)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floattidf_test.c b/test/Unit/floattidf_test.c index 4fcf272d8285..cfe40849960d 100644 --- a/test/Unit/floattidf_test.c +++ b/test/Unit/floattidf_test.c @@ -173,6 +173,8 @@ int main() return 1; if (test__floattidf(make_ti(0x023479FD0E092DE0LL, 14), 0x1.1A3CFE870496Fp+121)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floattisf_test.c b/test/Unit/floattisf_test.c index 7e43aa10523d..a83ec63a25c9 100644 --- a/test/Unit/floattisf_test.c +++ b/test/Unit/floattisf_test.c @@ -129,6 +129,8 @@ int main() if (test__floattisf(make_ti(0x0007FB72E4000000LL, 0), 0x1.FEDCB8p+114F)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floattixf_test.c b/test/Unit/floattixf_test.c index 5ba17f1beb25..4a9dfb56ac93 100644 --- a/test/Unit/floattixf_test.c +++ b/test/Unit/floattixf_test.c @@ -205,6 +205,8 @@ int main() if (test__floattixf(make_ti(0x0000123456789012LL, 0x34566FFFFFFFFFFFLL), 0x1.2345678901234566p+108L)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatundixf_test.c b/test/Unit/floatundixf_test.c index 43ac85f7a805..1974fa01012a 100644 --- a/test/Unit/floatundixf_test.c +++ b/test/Unit/floatundixf_test.c @@ -138,6 +138,8 @@ int main() if (test__floatundixf(0x023479FD0E092DE0ULL, 0x1.1A3CFE870496Fp+57)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatunssidfvfp_test.c b/test/Unit/floatunssidfvfp_test.c index fa174ef18add..4883af1cf5fa 100644 --- a/test/Unit/floatunssidfvfp_test.c +++ b/test/Unit/floatunssidfvfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__floatunssidfvfp(0xFFFFFFFF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatunssisfvfp_test.c b/test/Unit/floatunssisfvfp_test.c index 099f4e39a3ed..917061a91b18 100644 --- a/test/Unit/floatunssisfvfp_test.c +++ b/test/Unit/floatunssisfvfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__floatunssisfvfp(0xFFFFFFFF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatuntidf_test.c b/test/Unit/floatuntidf_test.c index 3b630f5c76ac..caad5d435e1a 100644 --- a/test/Unit/floatuntidf_test.c +++ b/test/Unit/floatuntidf_test.c @@ -167,6 +167,8 @@ int main() return 1; if (test__floatuntidf(make_ti(0x023479FD0E092DE0LL, 14), 0x1.1A3CFE870496Fp+121)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatuntisf_test.c b/test/Unit/floatuntisf_test.c index e80403b4991c..85c0727ce13a 100644 --- a/test/Unit/floatuntisf_test.c +++ b/test/Unit/floatuntisf_test.c @@ -158,6 +158,8 @@ int main() 0x1.FEDCBEp+76F)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/floatuntixf_test.c b/test/Unit/floatuntixf_test.c index 9d7f974f06ce..fc7531a9c823 100644 --- a/test/Unit/floatuntixf_test.c +++ b/test/Unit/floatuntixf_test.c @@ -212,6 +212,8 @@ int main() if (test__floatuntixf(make_ti(0x0000123456789012LL, 0x34566FFFFFFFFFFFLL), 0x1.2345678901234566p+108L)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/gedf2vfp_test.c b/test/Unit/gedf2vfp_test.c index 4731d3ffc3c5..e280ce0780a5 100644 --- a/test/Unit/gedf2vfp_test.c +++ b/test/Unit/gedf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__gedf2vfp(1.0, HUGE_VAL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/gesf2vfp_test.c b/test/Unit/gesf2vfp_test.c index 9f1c7568c0a8..aa53eb739979 100644 --- a/test/Unit/gesf2vfp_test.c +++ b/test/Unit/gesf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__gesf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/gtdf2vfp_test.c b/test/Unit/gtdf2vfp_test.c index f28297974f11..fd54e0b4e59f 100644 --- a/test/Unit/gtdf2vfp_test.c +++ b/test/Unit/gtdf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__gtdf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/gtsf2vfp_test.c b/test/Unit/gtsf2vfp_test.c index 03fb00e19937..2f4ad99a63d6 100644 --- a/test/Unit/gtsf2vfp_test.c +++ b/test/Unit/gtsf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__gtsf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ledf2vfp_test.c b/test/Unit/ledf2vfp_test.c index e7ed522ab4bb..5683590778c0 100644 --- a/test/Unit/ledf2vfp_test.c +++ b/test/Unit/ledf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__ledf2vfp(1.0, HUGE_VAL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/lesf2vfp_test.c b/test/Unit/lesf2vfp_test.c index dc5576b9e271..b5c20f61e8ad 100644 --- a/test/Unit/lesf2vfp_test.c +++ b/test/Unit/lesf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__lesf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/lshrti3_test.c b/test/Unit/lshrti3_test.c index 093a6a2eb888..f266b54f63c0 100644 --- a/test/Unit/lshrti3_test.c +++ b/test/Unit/lshrti3_test.c @@ -166,6 +166,8 @@ int main() if (test__lshrti3(make_ti(0xFEDCBA9876543215LL, 0xFEDCBA9876543215LL), 127, make_ti(0x0000000000000000LL, 0x0000000000000001LL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ltdf2vfp_test.c b/test/Unit/ltdf2vfp_test.c index 5051e4833a9a..7319397c5e4d 100644 --- a/test/Unit/ltdf2vfp_test.c +++ b/test/Unit/ltdf2vfp_test.c @@ -44,6 +44,8 @@ int main() return 1; if (test__ltdf2vfp(1.0, HUGE_VAL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ltsf2vfp_test.c b/test/Unit/ltsf2vfp_test.c index 78d2c1a3ae38..2d920c959326 100644 --- a/test/Unit/ltsf2vfp_test.c +++ b/test/Unit/ltsf2vfp_test.c @@ -46,6 +46,8 @@ int main() return 1; if (test__ltsf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/modti3_test.c b/test/Unit/modti3_test.c index 3be071495ad0..bd05c7237d2e 100644 --- a/test/Unit/modti3_test.c +++ b/test/Unit/modti3_test.c @@ -88,6 +88,8 @@ int main() if (test__modti3(make_ti(0x8000000000000000LL, 0), -3, -2)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/muldf3vfp_test.c b/test/Unit/muldf3vfp_test.c index 7ca5559c3aab..73454bf290aa 100644 --- a/test/Unit/muldf3vfp_test.c +++ b/test/Unit/muldf3vfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__muldf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/mulsf3vfp_test.c b/test/Unit/mulsf3vfp_test.c index fcb124c94717..92cf1f128497 100644 --- a/test/Unit/mulsf3vfp_test.c +++ b/test/Unit/mulsf3vfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__mulsf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/multc3_test.c b/test/Unit/multc3_test.c index 40505f217f70..f8c66c0e426f 100644 --- a/test/Unit/multc3_test.c +++ b/test/Unit/multc3_test.c @@ -367,7 +367,8 @@ int main() return 1; } } - +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/multi3_test.c b/test/Unit/multi3_test.c index a4c0b7dbdf51..f8c6605eb254 100644 --- a/test/Unit/multi3_test.c +++ b/test/Unit/multi3_test.c @@ -127,6 +127,8 @@ int main() make_ti(0x0000000000000000LL, 0x00B504F333F9DE5BLL), make_ti(0x7FFFFFFFFFFFF328LL, 0xDF915DA296E8A000LL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/mulvti3_test.c b/test/Unit/mulvti3_test.c index dfe09ffc86b0..be1aa2d331c6 100644 --- a/test/Unit/mulvti3_test.c +++ b/test/Unit/mulvti3_test.c @@ -253,6 +253,8 @@ int main() // make_ti(0x8000000000000000LL, 0x0000000000000000LL))) // abort // return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/mulxc3_test.c b/test/Unit/mulxc3_test.c index 771d19ab273b..4297c162bd8e 100644 --- a/test/Unit/mulxc3_test.c +++ b/test/Unit/mulxc3_test.c @@ -368,6 +368,8 @@ int main() } } +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/nedf2vfp_test.c b/test/Unit/nedf2vfp_test.c index 8fdac1a03720..2c4404399633 100644 --- a/test/Unit/nedf2vfp_test.c +++ b/test/Unit/nedf2vfp_test.c @@ -44,6 +44,8 @@ int main() return 1; if (test__nedf2vfp(1.0, HUGE_VAL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/negdf2vfp_test.c b/test/Unit/negdf2vfp_test.c index 7bdf155d392f..dc55428d6780 100644 --- a/test/Unit/negdf2vfp_test.c +++ b/test/Unit/negdf2vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__negdf2vfp(-1.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/negsf2vfp_test.c b/test/Unit/negsf2vfp_test.c index 419b32d726a5..ef54cee1dbee 100644 --- a/test/Unit/negsf2vfp_test.c +++ b/test/Unit/negsf2vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__negsf2vfp(-1.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/negti2_test.c b/test/Unit/negti2_test.c index 6ecc8628d77e..1945accfa952 100644 --- a/test/Unit/negti2_test.c +++ b/test/Unit/negti2_test.c @@ -120,6 +120,8 @@ int main() make_ti(0x8000000000000000LL, 0x0000000000000001LL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/negvti2_test.c b/test/Unit/negvti2_test.c index 1dc904e10ab8..772840989ad6 100644 --- a/test/Unit/negvti2_test.c +++ b/test/Unit/negvti2_test.c @@ -102,6 +102,8 @@ int main() if (test__negvti2(make_ti(0x7FFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/nesf2vfp_test.c b/test/Unit/nesf2vfp_test.c index 507b42ec3c4c..c085bf8b41fa 100644 --- a/test/Unit/nesf2vfp_test.c +++ b/test/Unit/nesf2vfp_test.c @@ -44,6 +44,8 @@ int main() return 1; if (test__nesf2vfp(1.0, HUGE_VALF)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/parityti2_test.c b/test/Unit/parityti2_test.c index c2f8d3d28a57..ac67b35669a7 100644 --- a/test/Unit/parityti2_test.c +++ b/test/Unit/parityti2_test.c @@ -57,6 +57,8 @@ int main() ((ti_int)rand() << 32) + rand())) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/popcountti2_test.c b/test/Unit/popcountti2_test.c index 53fee3b52a55..1b94a0c6aa51 100644 --- a/test/Unit/popcountti2_test.c +++ b/test/Unit/popcountti2_test.c @@ -75,6 +75,8 @@ int main() ((ti_int)rand() << 32) | rand())) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/powitf2_test.c b/test/Unit/powitf2_test.c index ca690fd103a0..817cb1130dee 100644 --- a/test/Unit/powitf2_test.c +++ b/test/Unit/powitf2_test.c @@ -225,6 +225,8 @@ int main() if (test__powitf2(-2, -31, -1/2147483648.)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/powixf2_test.c b/test/Unit/powixf2_test.c index 67d2463ca83f..201870b37f15 100644 --- a/test/Unit/powixf2_test.c +++ b/test/Unit/powixf2_test.c @@ -225,6 +225,8 @@ int main() if (test__powixf2(-2, -31, -1/2147483648.)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/subdf3vfp_test.c b/test/Unit/subdf3vfp_test.c index d1517ec51e38..86d6f2fef22b 100644 --- a/test/Unit/subdf3vfp_test.c +++ b/test/Unit/subdf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__subdf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/subsf3vfp_test.c b/test/Unit/subsf3vfp_test.c index aabd01d749f8..223e7f8f3936 100644 --- a/test/Unit/subsf3vfp_test.c +++ b/test/Unit/subsf3vfp_test.c @@ -41,6 +41,8 @@ int main() return 1; if (test__subsf3vfp(0.0, -0.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/subvti3_test.c b/test/Unit/subvti3_test.c index a579a1fc188b..6176bdfda97a 100644 --- a/test/Unit/subvti3_test.c +++ b/test/Unit/subvti3_test.c @@ -73,6 +73,8 @@ int main() if (test__subvti3(-1, make_ti(0x7FFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/trampoline_setup_test.c b/test/Unit/trampoline_setup_test.c index c6dbe70e0209..dc30fb6df60a 100644 --- a/test/Unit/trampoline_setup_test.c +++ b/test/Unit/trampoline_setup_test.c @@ -57,7 +57,8 @@ int main() { #else int main() { - return 0; + printf("skipped\n"); + return 0; } #endif diff --git a/test/Unit/truncdfsf2vfp_test.c b/test/Unit/truncdfsf2vfp_test.c index 4a44dc7919f7..afc7868b0de0 100644 --- a/test/Unit/truncdfsf2vfp_test.c +++ b/test/Unit/truncdfsf2vfp_test.c @@ -43,6 +43,8 @@ int main() return 1; if (test__truncdfsf2vfp(123.456)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/ucmpti2_test.c b/test/Unit/ucmpti2_test.c index d17fbb245786..55f820b89f2c 100644 --- a/test/Unit/ucmpti2_test.c +++ b/test/Unit/ucmpti2_test.c @@ -109,6 +109,8 @@ int main() if (test__ucmpti2(make_tu(0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL), make_tu(0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL), 1)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/udivmodti4_test.c b/test/Unit/udivmodti4_test.c index 620929ae061e..e0cae35ea7ae 100644 --- a/test/Unit/udivmodti4_test.c +++ b/test/Unit/udivmodti4_test.c @@ -65346,6 +65346,8 @@ int main() if (test__udivmodti4(tests[i][0], tests[i][1], tests[i][2], tests[i][3])) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/udivti3_test.c b/test/Unit/udivti3_test.c index a94739a7c189..09e0e1cf70d9 100644 --- a/test/Unit/udivti3_test.c +++ b/test/Unit/udivti3_test.c @@ -60,6 +60,8 @@ int main() make_tu(0x7FFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL))) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/umodti3_test.c b/test/Unit/umodti3_test.c index d75a1b3f956c..5eac2d834fbf 100644 --- a/test/Unit/umodti3_test.c +++ b/test/Unit/umodti3_test.c @@ -58,6 +58,8 @@ int main() 2, 0x1uLL)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/unorddf2vfp_test.c b/test/Unit/unorddf2vfp_test.c index 1031138ae4bd..d49d567896ae 100644 --- a/test/Unit/unorddf2vfp_test.c +++ b/test/Unit/unorddf2vfp_test.c @@ -42,6 +42,8 @@ int main() return 1; if (test__unorddf2vfp(1.0, 1.0)) return 1; +#else + printf("skipped\n"); #endif return 0; } diff --git a/test/Unit/unordsf2vfp_test.c b/test/Unit/unordsf2vfp_test.c index dedd7ecdd8c8..3cadc81c708b 100644 --- a/test/Unit/unordsf2vfp_test.c +++ b/test/Unit/unordsf2vfp_test.c @@ -42,6 +42,8 @@ int main() return 1; if (test__unordsf2vfp(1.0, 1.0)) return 1; +#else + printf("skipped\n"); #endif return 0; }