Commit a1c8363d by Jeff Law

Initial revision

From-SVN: r14289
parent 5a060962
long udivmodsi4 ();
long
__divsi3 (long a, long b)
{
int neg = 0;
long res;
if (a < 0)
{
a = -a;
neg = !neg;
}
if (b < 0)
{
b = -b;
neg = !neg;
}
res = udivmodsi4 (a, b, 0);
if (neg)
res = -res;
return res;
}
long
__modsi3 (long a, long b)
{
int neg = 0;
long res;
if (a < 0)
{
a = -a;
neg = 1;
}
if (b < 0)
b = -b;
res = udivmodsi4 (a, b, 1);
if (neg)
res = -res;
return res;
}
LIBGCC1=libgcc1.null
CROSS_LIBGCC1 = libgcc1-asm.a
LIB1ASMSRC = mn10200/lib1funcs.asm
LIB1ASMFUNCS = _divhi3 \
_modhi3 \
_addsi3 \
_subsi3 \
_mulsi3 \
_ashlsi3 \
_lshrsi3 \
_ashrsi3 \
_negsi2_d0 \
_negsi2_d2 \
_zero_extendpsisi2_d0 \
_zero_extendpsisi2_d2 \
_sign_extendpsisi2_d0 \
_sign_extendpsisi2_d2 \
_truncsipsi2_d0_d0 \
_truncsipsi2_d0_d1 \
_truncsipsi2_d0_d2 \
_truncsipsi2_d0_d3 \
_truncsipsi2_d2_d0 \
_truncsipsi2_d2_d1 \
_truncsipsi2_d2_d2 \
_truncsipsi2_d2_d3 \
_cmpsi2 \
_ucmpsi2 \
_prologue \
_epilogue_a0 \
_epilogue_d0 \
_epilogue_noreturn
# These are really part of libgcc1, but this will cause them to be
# built correctly, so...
# We do not have DF or DI types, so fake out the libgcc2 compilation.
LIBGCC2_CFLAGS = -g -O2 -DDF=SF -DDI=SI $(GCC_CFLAGS) $(LIBGCC2_INCLUDES)
LIB2FUNCS_EXTRA = fp-bit.c $(srcdir)/config/mn10200/udivmodsi4.c \
$(srcdir)/config/mn10200/divmod.c $(srcdir)/config/mn10200/udivmod.c
fp-bit.c: $(srcdir)/config/fp-bit.c
echo '#define FLOAT' > fp-bit.c
echo '#define FLOAT_ONLY' >> fp-bit.c
echo '#define SMALL_MACHINE' >> fp-bit.c
echo '#define CMPtype HItype' >> fp-bit.c
echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
echo '#endif' >> fp-bit.c
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
long udivmodsi4 ();
long
__udivsi3 (long a, long b)
{
return udivmodsi4 (a, b, 0);
}
long
__umodsi3 (long a, long b)
{
return udivmodsi4 (a, b, 1);
}
unsigned long
udivmodsi4(unsigned long num, unsigned long den, int modwanted)
{
unsigned long bit = 1;
unsigned long res = 0;
while (den < num && bit && !(den & (1L<<31)))
{
den <<=1;
bit <<=1;
}
while (bit)
{
if (num >= den)
{
num -= den;
res |= bit;
}
bit >>=1;
den >>=1;
}
if (modwanted) return num;
return res;
}
/* Configuration for Matsushita MN10200.
Copyright (C) 1997 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* #defines that need visibility everywhere. */
#define FALSE 0
#define TRUE 1
/* This describes the machine the compiler is hosted on. */
#define HOST_BITS_PER_CHAR 8
#define HOST_BITS_PER_SHORT 16
#define HOST_BITS_PER_INT 16
#define HOST_BITS_PER_LONG 32
#define HOST_BITS_PER_LONGLONG 64
/* Arguments to use with `exit'. */
#define SUCCESS_EXIT_CODE 0
#define FATAL_EXIT_CODE 33
/* target machine dependencies.
tm.h is a symbolic link to the actual target specific file. */
#include "tm.h"
#ifndef __STDC__
extern char *malloc (), *realloc (), *calloc ();
#else
extern void *malloc (), *realloc (), *calloc ();
#endif
extern void free ();
/* CYGNUS LOCAL entire file/law */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but
__gnuc_va_list. */
#if defined (_STDARG_H) || defined (_VARARGS_H)
#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs())
#define __va_ellipsis ...
#ifdef _STDARG_H
#define va_start(AP, LASTARG) \
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
#else
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; __va_ellipsis
#define va_start(AP) AP=(char *) &__builtin_va_alist
#endif
/* Now stuff common to both varargs & stdarg implementations. */
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#undef va_end
void va_end (__gnuc_va_list);
#define va_end(AP) ((void)0)
#define va_arg(AP, TYPE) \
(sizeof (TYPE) > 8 \
? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
**((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
#endif
/* END CYGNUS LOCAL */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment