Move abi bits to separate header. Force AAPCS for EABI in accordance with ARM RTABI.

llvm-svn: 129769
This commit is contained in:
Anton Korobeynikov 2011-04-19 17:52:09 +00:00
parent 75e3c1993c
commit e63da933eb
60 changed files with 144 additions and 115 deletions

View File

@ -11,6 +11,7 @@
*
*===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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);

View File

@ -10,7 +10,8 @@
* This file implements __absvsi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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);

View File

@ -12,14 +12,15 @@
//
//===----------------------------------------------------------------------===//
#include "int_lib.h"
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
ARM_EABI_FNALIAS(dadd, adddf3);
fp_t __adddf3(fp_t a, fp_t b) {
COMPILER_RT_ABI fp_t
__adddf3(fp_t a, fp_t b) {
rep_t aRep = toRep(a);
rep_t bRep = toRep(b);

View File

@ -12,11 +12,11 @@
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(fadd, addsf3);
fp_t __addsf3(fp_t a, fp_t b) {

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -20,7 +21,7 @@
ARM_EABI_FNALIAS(llsl, ashldi3);
di_int
COMPILER_RT_ABI di_int
__ashldi3(di_int a, si_int b)
{
const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -20,7 +21,7 @@
ARM_EABI_FNALIAS(lasr, ashrdi3);
di_int
COMPILER_RT_ABI di_int
__ashrdi3(di_int a, si_int b)
{
const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -15,12 +15,11 @@
// underflow with correct rounding.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(ddiv, divdf3);
fp_t __divdf3(fp_t a, fp_t b) {

View File

@ -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;

View File

@ -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);

View File

@ -15,12 +15,11 @@
// underflow with correct rounding.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(fdiv, divsf3);
fp_t __divsf3(fp_t a, fp_t b) {

View File

@ -11,16 +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 */
ARM_EABI_FNALIAS(idiv, divsi3);
si_int
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;

View File

@ -41,7 +41,7 @@
#include <stdint.h>
#include <limits.h>
#include "int_lib.h"
#include "abi.h"
typedef float src_t;
typedef uint32_t src_rep_t;

View File

@ -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;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -25,7 +26,7 @@
ARM_EABI_FNALIAS(d2lz, fixsfdi);
di_int
COMPILER_RT_ABI di_int
__fixsfdi(float a)
{
float_bits fb;

View File

@ -12,16 +12,15 @@
// conversion is undefined for out of range values in the C standard.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(f2iz, fixsfsi);
int __fixsfsi(fp_t a) {
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;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -28,7 +29,7 @@
ARM_EABI_FNALIAS(d2ulz, fixunsdfdi);
du_int
COMPILER_RT_ABI du_int
__fixunsdfdi(double a)
{
double_bits fb;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -28,7 +29,7 @@
ARM_EABI_FNALIAS(d2uiz, fixunsdfsi);
su_int
COMPILER_RT_ABI su_int
__fixunsdfsi(double a)
{
double_bits fb;

View File

@ -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,11 +26,9 @@
/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
#include "int_lib.h"
ARM_EABI_FNALIAS(f2ulz, fixunssfdi);
du_int
COMPILER_RT_ABI du_int
__fixunssfdi(float a)
{
float_bits fb;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -28,7 +29,7 @@
ARM_EABI_FNALIAS(f2uiz, fixunssfsi);
su_int
COMPILER_RT_ABI su_int
__fixunssfsi(float a)
{
float_bits fb;

View File

@ -11,6 +11,7 @@
*
*===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <float.h>
@ -23,8 +24,6 @@
/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
#include "int_lib.h"
ARM_EABI_FNALIAS(l2d, floatdidf);
#ifndef __SOFT_FP__
@ -33,7 +32,7 @@ ARM_EABI_FNALIAS(l2d, floatdidf);
*/
#include <stdint.h>
double
COMPILER_RT_ABI double
__floatdidf(di_int a)
{
static const double twop52 = 0x1.0p52;
@ -53,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)

View File

@ -12,7 +12,7 @@
*===----------------------------------------------------------------------===
*/
#include "int_lib.h"
#include "abi.h"
#include <float.h>
/* Returns: convert a to a float, rounding toward even.*/
@ -27,7 +27,7 @@
ARM_EABI_FNALIAS(l2f, floatdisf);
float
COMPILER_RT_ABI float
__floatdisf(di_int a)
{
if (a == 0)

View File

@ -12,7 +12,7 @@
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
#include "abi.h"
#include <float.h>
/* Returns: convert a to a double, rounding toward even. */
@ -34,7 +34,7 @@ ARM_EABI_FNALIAS(ul2d, floatundidf);
#include <stdint.h>
double
COMPILER_RT_ABI double
__floatundidf(du_int a)
{
static const double twop52 = 0x1.0p52;
@ -56,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)

View File

@ -12,7 +12,7 @@
*===----------------------------------------------------------------------===
*/
#include "int_lib.h"
#include "abi.h"
#include <float.h>
/* Returns: convert a to a float, rounding toward even. */
@ -27,7 +27,7 @@
ARM_EABI_FNALIAS(ul2f, floatundisf);
float
COMPILER_RT_ABI float
__floatundisf(du_int a)
{
if (a == 0)

View File

@ -37,13 +37,6 @@ extern void panic (const char *, ...);
#define INFINITY HUGE_VAL
#endif /* INFINITY */
#if __ARM_EABI__
# define ARM_EABI_FNALIAS(aeabi_name, name) \
void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
#else
# define ARM_EABI_FNALIAS(aeabi_name, name)
#endif
typedef int si_int;
typedef unsigned su_int;

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -20,7 +21,7 @@
ARM_EABI_FNALIAS(llsr, lshrdi3);
di_int
COMPILER_RT_ABI di_int
__lshrdi3(di_int a, si_int b)
{
const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);

View File

@ -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;

View File

@ -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;

View File

@ -11,15 +11,15 @@
// with the IEEE-754 default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(dmul, muldf3);
fp_t __muldf3(fp_t a, fp_t b) {
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;

View File

@ -10,7 +10,8 @@
* This file implements __muldi3 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
*/
#include "abi.h"
#include "int_lib.h"
@ -42,7 +43,7 @@ __muldsi3(su_int a, su_int b)
ARM_EABI_FNALIAS(lmul, muldi3);
di_int
COMPILER_RT_ABI di_int
__muldi3(di_int a, di_int b)
{
dwords x;

View File

@ -11,15 +11,15 @@
// with the IEEE-754 default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(fmul, mulsf3);
fp_t __mulsf3(fp_t a, fp_t b) {
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;

View File

@ -10,12 +10,11 @@
// This file implements double-precision soft-float negation.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(dneg, negdf2);
fp_t __negdf2(fp_t a) {

View File

@ -10,14 +10,14 @@
// This file implements single-precision soft-float negation.
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
ARM_EABI_FNALIAS(fneg, negsf2);
fp_t __negsf2(fp_t a) {
COMPILER_RT_ABI fp_t
__negsf2(fp_t a) {
return fromRep(toRep(a) ^ signBit);
}

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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);

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
#include <stdlib.h>
@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -11,19 +11,19 @@
// IEEE-754 default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define DOUBLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
fp_t __adddf3(fp_t a, fp_t b);
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.
fp_t __subdf3(fp_t a, fp_t b) {
COMPILER_RT_ABI fp_t
__subdf3(fp_t a, fp_t b) {
return __adddf3(a, fromRep(toRep(b) ^ signBit));
}

View File

@ -11,18 +11,18 @@
// IEEE-754 default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
#include "abi.h"
#define SINGLE_PRECISION
#include "fp_lib.h"
#include "int_lib.h"
fp_t __addsf3(fp_t a, fp_t b);
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.
fp_t __subsf3(fp_t a, fp_t b) {
COMPILER_RT_ABI fp_t
__subsf3(fp_t a, fp_t b) {
return __addsf3(a, fromRep(toRep(b) ^ signBit));
}

View File

@ -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 <stdlib.h>
@ -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;

View File

@ -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 <stdlib.h>
@ -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;

View File

@ -41,7 +41,7 @@
#include <limits.h>
#include <stdbool.h>
#include "int_lib.h"
#include "abi.h"
typedef double src_t;
typedef uint64_t src_rep_t;
@ -70,7 +70,8 @@ static inline dst_t dstFromRep(dst_rep_t x) {
ARM_EABI_FNALIAS(d2f, truncdfsf2);
dst_t __truncdfsf2(src_t a) {
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.

View File

@ -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;

View File

@ -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);

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -22,7 +23,7 @@
ARM_EABI_FNALIAS(uldivmod, udivmoddi4);
du_int
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;

View File

@ -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;
}

View File

@ -11,6 +11,7 @@
*
* ===----------------------------------------------------------------------===
*/
#include "abi.h"
#include "int_lib.h"
@ -20,7 +21,7 @@
ARM_EABI_FNALIAS(uidiv, udivsi3);
su_int
COMPILER_RT_ABI su_int
__udivsi3(su_int n, su_int d)
{
const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT;

View File

@ -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;

View File

@ -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;