Commit 36a05131 by Bernd Schmidt Committed by Bernd Schmidt

Add the FRV port

From-SVN: r56029
parent 37b8715b
2002-08-04 Bernd Schmidt <bernds@redhat.com>
Contribute a port developed primarily by Michael Meissner,
Catherine Moore, and Richard Sandiford <rsandifo@redhat.com>.
* config.gcc: Add frv-elf target.
* config/frv/cmovd.c: New file.
* config/frv/cmovh.c: New file.
* config/frv/cmovw.c: New file.
* config/frv/frv-abi.h: New file.
* config/frv/frv-asm.h: New file.
* config/frv/frv-modes.def: New file.
* config/frv/frv-protos.h: New file.
* config/frv/frv.c: New file.
* config/frv/frv.h: New file.
* config/frv/frv.md: New file.
* config/frv/frvbegin.c: New file.
* config/frv/frvend.c: New file.
* config/frv/lib1funcs.asm: New file.
* config/frv/media.h: New file.
* config/frv/modi.c: New file.
* config/frv/t-frv: New file.
* config/frv/uitod.c: New file.
* config/frv/uitof.c: New file.
* config/frv/ulltod.c: New file.
* config/frv/ulltof.c: New file.
* config/frv/umodi.c: New file.
* config/frv/xm-frv.h: New file.
2002-08-04 Nathan Sidwell <nathan@codesourcery.com> 2002-08-04 Nathan Sidwell <nathan@codesourcery.com>
* gcov.c (bb_file_time): New static variable. * gcov.c (bb_file_time): New static variable.
......
...@@ -717,6 +717,10 @@ fr30-*-elf) ...@@ -717,6 +717,10 @@ fr30-*-elf)
tmake_file=fr30/t-fr30 tmake_file=fr30/t-fr30
extra_parts="crti.o crtn.o crtbegin.o crtend.o" extra_parts="crti.o crtn.o crtbegin.o crtend.o"
;; ;;
frv-*-elf)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file} frv/frv-abi.h"
tmake_file=frv/t-frv
;;
h8300-*-rtems*) h8300-*-rtems*)
xm_defines=POSIX xm_defines=POSIX
tmake_file="h8300/t-h8300 t-rtems" tmake_file="h8300/t-h8300 t-rtems"
......
/* Move double-word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
void
__cmovd (long long *dest, const long long *src, unsigned len)
{
unsigned i;
unsigned num = len >> 3;
unsigned xlen = len & ~7;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
while (len > xlen)
{
dest_byte[xlen] = src_byte[xlen];
xlen++;
}
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Move half-word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
void
__cmovh (short *dest, const short *src, unsigned len)
{
unsigned i;
unsigned num = len >> 1;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
if ((len & 1) != 0)
dest_byte[len-1] = src_byte[len-1];
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Move word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
void
__cmovw (int *dest, const int *src, unsigned len)
{
unsigned i;
unsigned num = len >> 2;
unsigned xlen = len & ~3;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
while (len > xlen)
{
dest_byte[xlen] = src_byte[xlen];
xlen++;
}
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Frv map GCC names to FR-V ABI.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
/* For each of the functions in the library that has a corresponding name in
the ABI, add an equivalence between the GCC name and the ABI name. This is
in a separate file from frv.h so that fp-bit.c can be made to include it. */
#ifdef __GNUC__
#ifdef __FRV_UNDERSCORE__
#define RENAME_LIBRARY(OLD,NEW) \
__asm__ (".globl\t_" #NEW "\n" \
"_" #NEW "=_" #OLD "\n" \
"\t.type\t_" #NEW ",@function\n");
#else
#define RENAME_LIBRARY(OLD,NEW) \
__asm__ (".globl\t" #NEW "\n" \
#NEW "=" #OLD "\n" \
"\t.type\t" #NEW ",@function\n");
#endif
#define CREATE_DOUBLE_SHIFT(OLD,NEW) \
__asm__ (".text\n" \
"\t.globl\t" #NEW "\n" \
"\t.type\t" #NEW ",@function\n" \
#NEW ":\n" \
"\tor\tgr11, gr0, gr10\n" \
"\tbra\t" #OLD "\n");
#ifdef L_sf_to_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__extendsfdf2,__ftod)
#endif
#ifdef L_sf_to_si
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixsfsi,__ftoi)
#endif
#ifdef L_sf_to_usi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfsi,__ftoui)
#endif
#ifdef L_df_to_si
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixdfsi,__dtoi)
#endif
#ifdef L_fixunssfsi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfsi,__ftoui)
#endif
#ifdef L_fixunsdfsi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunsdfsi,__dtoui)
#endif
#ifdef L_fixsfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixsfdi,__ftoll)
#endif
#ifdef L_fixdfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixdfdi,__dtoll)
#endif
#ifdef L_fixunssfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfdi,__ftoull)
#endif
#ifdef L_fixunsdfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunsdfdi,__dtoull)
#endif
#ifdef L_si_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatsisf,__itof)
#endif
#ifdef L_di_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdisf,__lltof)
#endif
#ifdef L_df_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__truncdfsf2,__dtof)
#endif
#ifdef L_si_to_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatsidf,__itod)
#endif
#ifdef L_floatdisf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdisf,__lltof)
#endif
#ifdef L_floatdidf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdidf,__lltod)
#endif
#ifdef L_addsub_df
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__adddf3,__addd)
RENAME_LIBRARY(__subdf3,__subd)
#endif
#ifdef L_mul_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__muldf3,__muld)
#endif
#ifdef L_div_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divdf3,__divd)
#endif
#ifdef L_addsub_sf
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__addsf3,__addf) \
RENAME_LIBRARY(__subsf3,__subf)
#endif
#ifdef L_mul_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__mulsf3,__mulf)
#endif
#ifdef L_div_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divsf3,__divf)
#endif
#ifdef L_ashldi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__ashldi3,__sllll)
#endif
#ifdef L_lshrdi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__lshrdi3,__srlll)
#endif
#ifdef L_ashrdi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__ashrdi3,__srall)
#endif
#ifdef L_adddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__adddi3,__addll)
#endif
#ifdef L_subdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__subdi3,__subll)
#endif
#ifdef L_muldi3
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__muldi3,__mulll)
RENAME_LIBRARY(__muldi3,__umulll)
#endif
#ifdef L_divdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divdi3,__divll)
#endif
#ifdef L_udivdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__udivdi3,__udivll)
#endif
#ifdef L_moddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__moddi3,__modll)
#endif
#ifdef L_umoddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__umoddi3,__umodll)
#endif
#endif /* __GNUC__ */
/* Assembler Support.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
/* P(INSN): Emit INSN.P for VLIW machines, otherwise emit plain INSN.
P2(INSN): Emit INSN.P on the FR500 and above, otherwise emit plain INSN. */
#ifdef __FRV_VLIW__
#ifdef __STDC__
#define P(A) A##.p
#else
#define P(A) A/**/.p
#endif
#if __FRV_VLIW__ > 2
#define P2(A) P(A)
#else
#define P2(A) A
#endif
#else
#define P(A) A
#define P2(A) A
#endif
/* Add underscore if necessary to external name. */
#ifdef __FRV_UNDERSCORE__
#ifdef __STDC__
#define EXT(NAME) _##NAME
#else
#define EXT(NAME) _/**/NAME
#endif
#else
#define EXT(NAME) NAME
#endif
/* Definitions of target machine for GNU compiler for FRV.
Copyright (C) 2002 Free Software Foundation, Inc.
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. */
/* On the FRV, the CC modes used are:
CCmode set ICC's from comparing signed integers
CC_UNSmode set ICC's from comparing unsigned integers
CC_FPmode set FCC's from comparing floating point
CC_CCRmode set CCR's to do conditional execution */
CC (CC_UNS)
CC (CC_FP)
CC (CC_CCR)
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/* Frv initialization file linked before all user modules
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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.
This file was originally taken from the file crtstuff.c in the
main compiler directory, and simplified. */
#include "defaults.h"
#include <stddef.h>
#include "unwind-dw2-fde.h"
#include "gbl-ctors.h"
/* Declare a pointer to void function type. */
#define STATIC static
#ifdef __FRV_UNDERSCORE__
#define UNDERSCORE "_"
#else
#define UNDERSCORE ""
#endif
#define INIT_SECTION_NEG_ONE(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".word -1\n\t" \
".previous")
#define INIT_SECTION(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".previous")
/* Beginning of .ctor/.dtor sections that provides a list of constructors and
destructors to run. */
INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__");
INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__");
/* Beginning of .eh_frame section that provides all of the exception handling
tables. */
INIT_SECTION (".eh_frame", "\"aw\"", "__EH_FRAME_BEGIN__");
/* Beginning of .rofixup section that provides a list of pointers that we
need to adjust. */
INIT_SECTION (".rofixup", "\"a\"", "__ROFIXUP_LIST__");
extern void __frv_register_eh(void) __attribute__((__constructor__));
extern void __frv_deregister_eh(void) __attribute__((__destructor__));
extern func_ptr __EH_FRAME_BEGIN__[];
/* Register the exeception handling table as the first constructor */
void
__frv_register_eh (void)
{
static struct object object;
if (__register_frame_info)
__register_frame_info (__EH_FRAME_BEGIN__, &object);
}
/* Note, do not declare __{,de}register_frame_info weak as it seems
to interfere with the pic support. */
/* Unregister the exeception handling table as a deconstructor */
void
__frv_deregister_eh (void)
{
static int completed = 0;
if (completed)
return;
if (__deregister_frame_info)
__deregister_frame_info (__EH_FRAME_BEGIN__);
completed = 1;
}
/* Run the global destructors */
void
__do_global_dtors ()
{
static func_ptr *p = __DTOR_LIST__ + 1;
while (*p)
{
p++;
(*(p-1)) ();
}
}
/* Run the global constructors */
void
__do_global_ctors ()
{
unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
unsigned i;
if (nptrs == (unsigned long)-1)
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
for (i = nptrs; i >= 1; i--)
__CTOR_LIST__[i] ();
atexit (__do_global_dtors);
}
/* Subroutine called automatically by `main'.
Compiling a global function named `main'
produces an automatic call to this function at the beginning.
For many systems, this routine calls __do_global_ctors.
For systems which support a .init section we use the .init section
to run __do_global_ctors, so we need not do anything here. */
void
__main ()
{
/* Support recursive calls to `main': run initializers just once. */
static int initialized;
if (! initialized)
{
initialized = 1;
__do_global_ctors ();
}
}
/* Frv initialization file linked after all user modules
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
#include "defaults.h"
#include <stddef.h>
#include "unwind-dw2-fde.h"
#ifdef __FRV_UNDERSCORE__
#define UNDERSCORE "_"
#else
#define UNDERSCORE ""
#endif
#define FINI_SECTION_ZERO(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".word 0\n\t" \
".previous")
#define FINI_SECTION(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".previous")
/* End of .ctor/.dtor sections that provides a list of constructors and
destructors to run. */
FINI_SECTION_ZERO (".ctors", "\"aw\"", "__CTOR_END__");
FINI_SECTION_ZERO (".dtors", "\"aw\"", "__DTOR_END__");
/* End of .eh_frame section that provides all of the exception handling
tables. */
FINI_SECTION_ZERO (".eh_frame", "\"aw\"", "__FRAME_END__");
/* End of .rofixup section that provides a list of pointers that we
need to adjust. */
FINI_SECTION (".rofixup", "\"a\"", "__ROFIXUP_END__");
/* Library functions.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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. */
#include <frv-asm.h>
#ifdef L_cmpll
/* icc0 = __cmpll (long long a, long long b) */
.file "_cmpll.s"
.globl EXT(__cmpll)
.type EXT(__cmpll),@function
.text
.p2align 4
EXT(__cmpll):
cmp gr8, gr10, icc0
ckeq icc0, cc4
P(ccmp) gr9, gr11, cc4, 1
ret
.Lend:
.size EXT(__cmpll),.Lend-EXT(__cmpll)
#endif /* L_cmpll */
#ifdef L_cmpf
/* icc0 = __cmpf (float a, float b) */
/* Note, because this function returns the result in ICC0, it means it can't
handle NaNs. */
.file "_cmpf.s"
.globl EXT(__cmpf)
.type EXT(__cmpf),@function
.text
.p2align 4
EXT(__cmpf):
#ifdef __FRV_HARD_FLOAT__ /* floating point instructions available */
movgf gr8, fr0
P(movgf) gr9, fr1
setlos #1, gr8
fcmps fr0, fr1, fcc0
P(fcklt) fcc0, cc0
fckeq fcc0, cc1
csub gr0, gr8, gr8, cc0, 1
cmov gr0, gr8, cc1, 1
cmpi gr8, 0, icc0
ret
#else /* no floating point instructions available */
movsg lr, gr4
addi sp, #-16, sp
sti gr4, @(sp, 8)
st fp, @(sp, gr0)
mov sp, fp
call EXT(__cmpsf2)
cmpi gr8, #0, icc0
ldi @(sp, 8), gr4
movgs gr4, lr
ld @(sp,gr0), fp
addi sp, #16, sp
ret
#endif
.Lend:
.size EXT(__cmpf),.Lend-EXT(__cmpf)
#endif
#ifdef L_cmpd
/* icc0 = __cmpd (double a, double b) */
/* Note, because this function returns the result in ICC0, it means it can't
handle NaNs. */
.file "_cmpd.s"
.globl EXT(__cmpd)
.type EXT(__cmpd),@function
.text
.p2align 4
EXT(__cmpd):
movsg lr, gr4
addi sp, #-16, sp
sti gr4, @(sp, 8)
st fp, @(sp, gr0)
mov sp, fp
call EXT(__cmpdf2)
cmpi gr8, #0, icc0
ldi @(sp, 8), gr4
movgs gr4, lr
ld @(sp,gr0), fp
addi sp, #16, sp
ret
.Lend:
.size EXT(__cmpd),.Lend-EXT(__cmpd)
#endif
#ifdef L_addll
/* gr8,gr9 = __addll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_addll.s"
.globl EXT(__addll)
.type EXT(__addll),@function
.text
.p2align
EXT(__addll):
addcc gr9, gr11, gr9, icc0
addx gr8, gr10, gr8, icc0
ret
.Lend:
.size EXT(__addll),.Lend-EXT(__addll)
#endif
#ifdef L_subll
/* gr8,gr9 = __subll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_subll.s"
.globl EXT(__subll)
.type EXT(__subll),@function
.text
.p2align 4
EXT(__subll):
subcc gr9, gr11, gr9, icc0
subx gr8, gr10, gr8, icc0
ret
.Lend:
.size EXT(__subll),.Lend-EXT(__subll)
#endif
#ifdef L_andll
/* gr8,gr9 = __andll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_andll.s"
.globl EXT(__andll)
.type EXT(__andll),@function
.text
.p2align 4
EXT(__andll):
P(and) gr9, gr11, gr9
P2(and) gr8, gr10, gr8
ret
.Lend:
.size EXT(__andll),.Lend-EXT(__andll)
#endif
#ifdef L_orll
/* gr8,gr9 = __orll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_orll.s"
.globl EXT(__orll)
.type EXT(__orll),@function
.text
.p2align 4
EXT(__orll):
P(or) gr9, gr11, gr9
P2(or) gr8, gr10, gr8
ret
.Lend:
.size EXT(__orll),.Lend-EXT(__orll)
#endif
#ifdef L_xorll
/* gr8,gr9 = __xorll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_xorll.s"
.globl EXT(__xorll)
.type EXT(__xorll),@function
.text
.p2align 4
EXT(__xorll):
P(xor) gr9, gr11, gr9
P2(xor) gr8, gr10, gr8
ret
.Lend:
.size EXT(__xorll),.Lend-EXT(__xorll)
#endif
#ifdef L_notll
/* gr8,gr9 = __notll (long long a) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_notll.s"
.globl EXT(__notll)
.type EXT(__notll),@function
.text
.p2align 4
EXT(__notll):
P(not) gr9, gr9
P2(not) gr8, gr8
ret
.Lend:
.size EXT(__notll),.Lend-EXT(__notll)
#endif
#ifdef L_cmov
/* (void) __cmov (char *dest, const char *src, size_t len) */
/*
* void __cmov (char *dest, const char *src, size_t len)
* {
* size_t i;
*
* if (dest < src || dest > src+len)
* {
* for (i = 0; i < len; i++)
* dest[i] = src[i];
* }
* else
* {
* while (len-- > 0)
* dest[len] = src[len];
* }
* }
*/
.file "_cmov.s"
.globl EXT(__cmov)
.type EXT(__cmov),@function
.text
.p2align 4
EXT(__cmov):
P(cmp) gr8, gr9, icc0
add gr9, gr10, gr4
P(cmp) gr8, gr4, icc1
bc icc0, 0, .Lfwd
bls icc1, 0, .Lback
.Lfwd:
/* move bytes in a forward direction */
P(setlos) #0, gr5
cmp gr0, gr10, icc0
P(subi) gr9, #1, gr9
P2(subi) gr8, #1, gr8
bnc icc0, 0, .Lret
.Lfloop:
/* forward byte move loop */
addi gr5, #1, gr5
P(ldsb) @(gr9, gr5), gr4
cmp gr5, gr10, icc0
P(stb) gr4, @(gr8, gr5)
bc icc0, 0, .Lfloop
ret
.Lbloop:
/* backward byte move loop body */
ldsb @(gr9,gr10),gr4
stb gr4,@(gr8,gr10)
.Lback:
P(cmpi) gr10, #0, icc0
addi gr10, #-1, gr10
bne icc0, 0, .Lbloop
.Lret:
ret
.Lend:
.size EXT(__cmov),.Lend-EXT(__cmov)
#endif
/* VENUS Family C Library V40L00 */
/* COPYRIGHT(C) FUJITSU LIMITED 1993-1999 */
#ifndef __MEDIA_H__
#define __MEDIA_H__
#ifdef __STDC__
#define __MEDIA_PASTE__(A,B) __MEDIA_XPASTE__(A,B)
#define __MEDIA_XPASTE__(A,B) A ## B
#else
#define __MEDIA_PASTE__(A,B) A/**/B
#endif
/* Floating Point Condition Code Field Type */
typedef enum
{
FCC0 = 0,
FCC1,
FCC2,
FCC3
} FCC_T;
/* Accumulator Type */
#define ACC0 0
#define ACC1 1
#define ACC2 2
#define ACC3 3
#define ACC4 4
#define ACC5 5
#define ACC6 6
#define ACC7 7
typedef unsigned char __mubyte;
typedef unsigned short __muhalf;
typedef unsigned long __muword1;
typedef unsigned long long __muword2;
typedef signed short __mshalf;
typedef signed long __msword1;
typedef signed long long __msword2;
typedef int ACC_T;
register __muword1 __acc0 __asm__("acc0");
register __muword1 __acc1 __asm__("acc1");
register __muword1 __acc2 __asm__("acc2");
register __muword1 __acc3 __asm__("acc3");
register __muword1 __acc4 __asm__("acc4");
register __muword1 __acc5 __asm__("acc5");
register __muword1 __acc6 __asm__("acc6");
register __muword1 __acc7 __asm__("acc7");
#define __ACC(N) __MEDIA_PASTE__(__acc,N)
/* Accumulator Guard Type */
#define ACCG0 0
#define ACCG1 1
#define ACCG2 2
#define ACCG3 3
#define ACCG4 4
#define ACCG5 5
#define ACCG6 6
#define ACCG7 7
typedef int ACCG_T;
register __mubyte __accg0 __asm__("accg0");
register __mubyte __accg1 __asm__("accg1");
register __mubyte __accg2 __asm__("accg2");
register __mubyte __accg3 __asm__("accg3");
register __mubyte __accg4 __asm__("accg4");
register __mubyte __accg5 __asm__("accg5");
register __mubyte __accg6 __asm__("accg6");
register __mubyte __accg7 __asm__("accg7");
#define __ACCG(N) __MEDIA_PASTE__(__accg,N)
/* 12-bit Immediate Type */
typedef int IMM12;
/* 6-bit Immediate Type */
typedef int IMM6;
/* 5-bit Immediate Type */
typedef int IMM5;
/* 5-bit Unsigned Immediate Type */
typedef int UIMM5;
/* 4-bit Unsigned Immediate Type */
typedef int UIMM4;
/* 1-bit Unsigned Immediate Type */
typedef int UIMM1;
/* Media Logical (Word) */
extern __muword1 __MAND(__muword1, __muword1);
extern __muword1 __MOR(__muword1, __muword1);
extern __muword1 __MXOR(__muword1, __muword1);
extern __muword1 __MNOT(__muword1);
/* Media Rotate (Word) */
extern __muword1 __MROTLI(__muword1, UIMM5);
extern __muword1 __MROTRI(__muword1, UIMM5);
/* Media Word Cut */
extern __muword1 __MWCUT(__muword2, __muword1);
/* Media Average (Halfword Dual) */
extern __muword1 __MAVEH(__muword1, __muword1);
/* Media Shift (Halfword Dual) */
extern __muword1 __MSLLHI(__muword1, UIMM4);
extern __muword1 __MSRLHI(__muword1, UIMM4);
extern __msword1 __MSRAHI(__msword1, UIMM4);
/* Media Saturation (Halfword Dual) */
extern __msword1 __MSATHS(__msword1, __msword1);
extern __muword1 __MSATHU(__muword1, __muword1);
#if 0 /* These are not supported. */
/* Media Dual Compare (Halfword Dual) */
extern void __MCMPSH(FCC_T, __msword1, __msword1);
extern void __MCMPUH(FCC_T, __muword1, __muword1);
#endif
/* Media Dual Saturation Add/Sub (Halfword Dual) */
extern __msword1 __MADDHSS(__msword1, __msword1);
extern __muword1 __MADDHUS(__muword1, __muword1);
extern __msword1 __MSUBHSS(__msword1, __msword1);
extern __muword1 __MSUBHUS(__muword1, __muword1);
/* Media Dual Mult (Halfword Dual) */
extern void __MMULHS(ACC_T, __msword1, __msword1);
extern void __MMULHU(ACC_T, __muword1, __muword1);
/* Media Dual Cross Mult (Halfword Dual) */
extern void __MMULXHS(ACC_T, __msword1, __msword1);
extern void __MMULXHU(ACC_T, __muword1, __muword1);
/* Media Dual Mult & Add (Halfword Dual) */
extern void __MMACHS(ACC_T, __msword1, __msword1);
extern void __MMACHU(ACC_T, __muword1, __muword1);
/* Media Dual Mult & Sub (Halfword Dual) */
extern void __MMRDHS(ACC_T, __msword1, __msword1);
extern void __MMRDHU(ACC_T, __muword1, __muword1);
/* Media Quad Saturation Add/Sub (Halfword Quad) */
extern __msword2 __MQADDHSS(__msword2, __msword2);
extern __muword2 __MQADDHUS(__muword2, __muword2);
extern __msword2 __MQSUBHSS(__msword2, __msword2);
extern __muword2 __MQSUBHUS(__muword2, __muword2);
/* Media Quad Mult (Halfword Quad) */
extern void __MQMULHS(ACC_T, __msword2, __msword2);
extern void __MQMULHU(ACC_T, __muword2, __muword2);
/* Media Quad Cross Mult (Halfword Quad) */
extern void __MQMULXHS(ACC_T, __msword2, __msword2);
extern void __MQMULXHU(ACC_T, __muword2, __muword2);
/* Media Quad Mult & Add (Halfword Quad) */
extern void __MQMACHS(ACC_T, __msword2, __msword2);
extern void __MQMACHU(ACC_T, __muword2, __muword2);
/* Media Dual Mult & Add for Complex (Halfword Dual) */
extern void __MCPXRS(ACC_T, __msword1, __msword1);
extern void __MCPXRU(ACC_T, __muword1, __muword1);
extern void __MCPXIS(ACC_T, __msword1, __msword1);
extern void __MCPXIU(ACC_T, __muword1, __muword1);
/* Media Quad Mult & Add for Complex (Halfword Quad) */
extern void __MQCPXRS(ACC_T, __msword2, __msword2);
extern void __MQCPXRU(ACC_T, __muword2, __muword2);
extern void __MQCPXIS(ACC_T, __msword2, __msword2);
extern void __MQCPXIU(ACC_T, __muword2, __muword2);
/* Media Cut */
extern __muword1 __MCUT(ACC_T, __muword1);
extern __muword1 __MCUTSS(ACC_T, __msword1);
/* Media Halfword Expand */
extern __muword1 __MEXPDHW(__muword1, UIMM1);
extern __muword2 __MEXPDHD(__muword1, UIMM1);
/* Media Halfword Pack/Unpack */
extern __muword1 __MPACKH(__muhalf, __muhalf);
extern __muword2 __MUNPACKH(__muword1);
/* Media Halfword Pack/Unpack (Dual) */
extern __muword2 __MDPACKH(__muword2, __muword2);
extern void __MDUNPACKH(__muword1[4], __muword2);
/* Media Byte-Halfword Convert */
extern __muword2 __MBTOH(__muword1);
extern __muword1 __MHTOB(__muword2);
extern void __MBTOHE(__muword1[4], __muword1);
/* Media Accumulator Clear */
extern void __MCLRACC(ACC_T);
extern void __MCLRACCA(void);
/* Media Accumlator Read/Write */
extern __muword1 __MRDACC(ACC_T);
extern __muword1 __MRDACCG(ACCG_T);
extern void __MWTACC(ACC_T, __muword1);
extern void __MWTACCG(ACCG_T, __muword1);
/* Media Custom */
extern __muword1 __Mcop1(__muword1, __muword1);
extern __muword1 __Mcop2(__muword1, __muword1);
/* Media Trap */
extern void __MTRAP(void);
/* The following are available on the FR400. The compiler will report an
error if an attempt is made to use them in FR500 code. */
/* Media Multiply And Add (Halfword) */
extern void __MQXMACHS(ACC_T, __msword2, __msword2);
extern void __MQXMACXHS(ACC_T, __msword2, __msword2);
extern void __MQMACXHS(ACC_T, __msword2, __msword2);
/* Media Accumulator Addition/Subtraction */
extern void __MADDACCS(ACC_T, ACC_T);
extern void __MSUBACCS(ACC_T, ACC_T);
extern void __MASACCS(ACC_T, ACC_T);
extern void __MDADDACCS(ACC_T, ACC_T);
extern void __MDSUBACCS(ACC_T, ACC_T);
extern void __MDASACCS(ACC_T, ACC_T);
/* Media Dual Absolute (Halfword) */
extern __muword1 __MABSHS(__msword1);
/* Media Dual Rotate Left */
extern __muword2 __MDROTLI(__muword2, UIMM5);
/* Media Dual Coupling */
extern __muword1 __MCPLHI(__muword2, UIMM4);
extern __muword1 __MCPLI(__muword2, UIMM5);
/* Media Dual Cut And Signed Saturation */
extern __muword2 __MDCUTSSI(ACC_T, IMM6);
/* Media Quad Saturation (Halfword) */
extern __msword2 __MQSATHS(__msword2, __msword2);
/* Media SETHI/SETLO */
extern __msword1 __MHSETLOS(__msword1, IMM12);
extern __msword1 __MHSETHIS(__msword1, IMM12);
extern __msword1 __MHDSETS(IMM12);
extern __muword1 __MHSETLOH(__muword1, IMM5);
extern __muword1 __MHSETHIH(__muword1, IMM5);
extern __muword1 __MHDSETH(__muword1, IMM5);
#endif /* __MEDIA_H__ */
int __modi (int a, int b)
{
return a % b;
}
double __uitod (unsigned int a)
{
return a;
}
float __uitof (unsigned int a)
{
return a;
}
double __ulltod (unsigned long long a)
{
return a;
}
float __ulltof (unsigned long long a)
{
return a;
}
unsigned int __umodi (unsigned int a, unsigned int b)
{
return a % b;
}
/* Definitions for Frv target
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
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
/* A C expression for the status code to be returned when the compiler exits
after serious errors. */
#define FATAL_EXIT_CODE 33
/* A C expression for the status code to be returned when the compiler exits
without serious errors. */
#define SUCCESS_EXIT_CODE 0
/* target machine dependencies.
tm.h is a symbolic link to the actual target specific file. */
#include "tm.h"
/* end of xm-frv.h */
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