MAINTAINERS: Add Nick Clifton and DJ Delorie as msp430 maintainers.
* MAINTAINERS: Add Nick Clifton and DJ Delorie as msp430 maintainers. [gcc] * config/msp430/: New port. * config.gcc (msp430): Added. * doc/invoke.texi: Document MSP430 options. * doc/install.texi: Document msp430-elf * doc/md.texi: Document msp430-elf * doc/contrib.texi: Document msp430-elf [libgcc] * config.host (msp*-*-elf): New. * config/msp430/: New port. [contrib] * config-list.mk: Add msp430-elf. From-SVN: r202535
This commit is contained in:
parent
8369f38a6f
commit
f6a83b4a9f
43 changed files with 4915 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-09-12 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* MAINTAINERS: Add Nick Clifton and DJ Delorie as msp430
|
||||
maintainers.
|
||||
|
||||
2013-09-03 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* configure.ac: Also allow ISL 0.12.
|
||||
|
|
|
@ -87,6 +87,8 @@ mmix port Hans-Peter Nilsson hp@bitrange.com
|
|||
mn10300 port Jeff Law law@redhat.com
|
||||
mn10300 port Alexandre Oliva aoliva@redhat.com
|
||||
moxie port Anthony Green green@moxielogic.com
|
||||
msp430 port DJ Delorie dj@redhat.com
|
||||
msp430 port Nick Clifton nickc@redhat.com
|
||||
nds32 port Chung-Ju Wu jasonwucj@gmail.com
|
||||
nds32 port Shiva Chen shiva0217@gmail.com
|
||||
pdp11 port Paul Koning ni1d@arrl.net
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2013-09-12 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config-list.mk: Add msp430-elf.
|
||||
|
||||
2013-08-31 Diego Novillo <dnovillo@google.com>
|
||||
|
||||
* testsuite-management/x86_64-unknown-linux-gnu.xfail: Update.
|
||||
|
|
|
@ -44,6 +44,7 @@ LIST = aarch64-elf aarch64-linux-gnu \
|
|||
mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
|
||||
mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
|
||||
moxie-uclinux moxie-rtems pdp11-aout picochip-elfOPT-enable-obsolete \
|
||||
msp430-elf \
|
||||
powerpc-darwin8 \
|
||||
powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
|
||||
powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
2013-09-12 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config/msp430/: New port.
|
||||
* config.gcc (msp430): Added.
|
||||
* doc/invoke.texi: Document MSP430 options.
|
||||
* doc/install.texi: Document msp430-elf
|
||||
* doc/md.texi: Document msp430-elf
|
||||
* doc/contrib.texi: Document msp430-elf
|
||||
|
||||
* cfgexpand.c (expand_debug_expr): Avoid sign-extending SImode to
|
||||
PSImode.
|
||||
|
||||
|
|
|
@ -2030,6 +2030,13 @@ mn10300-*-*)
|
|||
use_collect2=no
|
||||
use_gcc_stdint=wrap
|
||||
;;
|
||||
msp430*-*-*)
|
||||
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
|
||||
c_target_objs="msp430-c.o"
|
||||
cxx_target_objs="msp430-c.o"
|
||||
target_has_targetm_common=no
|
||||
tmake_file="${tmake_file} msp430/t-msp430"
|
||||
;;
|
||||
pdp11-*-*)
|
||||
tm_file="${tm_file} newlib-stdint.h"
|
||||
use_gcc_stdint=wrap
|
||||
|
|
7
gcc/config/msp430/README.txt
Normal file
7
gcc/config/msp430/README.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Random Notes
|
||||
------------
|
||||
|
||||
The MSP430 port does not use leading underscores. However, the
|
||||
assembler has no way of differentiating between, for example, register
|
||||
R12 and symbol R12. So, if you do "int r12;" in your C program, you
|
||||
may get an assembler error, and will certainly have runtime problems.
|
74
gcc/config/msp430/constraints.md
Normal file
74
gcc/config/msp430/constraints.md
Normal file
|
@ -0,0 +1,74 @@
|
|||
;; Machine Description for TI MSP43* processors
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
;; Contributed by Red Hat.
|
||||
|
||||
;; This file is part of GCC.
|
||||
|
||||
;; GCC 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 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GCC 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 GCC; see the file COPYING3. If not see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define_register_constraint "R12" "R12_REGS"
|
||||
"Register R12.")
|
||||
|
||||
(define_register_constraint "R13" "R13_REGS"
|
||||
"Register R13.")
|
||||
|
||||
(define_constraint "K"
|
||||
"Integer constant 1."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, 1, 1)")))
|
||||
|
||||
(define_constraint "L"
|
||||
"Integer constant -1^20..1^19."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, -1 << 20, 1 << 19)")))
|
||||
|
||||
(define_constraint "M"
|
||||
"Integer constant 1-4."
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (ival, 1, 4)")))
|
||||
|
||||
;; We do not allow arbitrary constants, eg symbols or labels,
|
||||
;; because their address may be above the 16-bit address limit
|
||||
;; supported by the offset used in the MOVA instruction.
|
||||
(define_constraint "Ya"
|
||||
"Memory reference, any type, but restricted range of constants"
|
||||
(and (match_code "mem")
|
||||
(ior (match_code "reg" "0")
|
||||
(and (match_code "plus" "0")
|
||||
(match_code "reg" "00")
|
||||
(match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")))
|
||||
(match_test "CONSTANT_P (XEXP (op, 0))")
|
||||
)))
|
||||
|
||||
(define_constraint "Yl"
|
||||
"Memory reference, labels only."
|
||||
(and (match_code "mem")
|
||||
(match_code "label_ref" "0")))
|
||||
|
||||
|
||||
;; These are memory references that are safe to use with the X suffix,
|
||||
;; because we know/assume they need not index across the 64k boundary.
|
||||
(define_constraint "Ys"
|
||||
"Memory reference, stack only."
|
||||
(and (match_code "mem")
|
||||
(ior
|
||||
(and (match_code "plus" "0")
|
||||
(and (match_code "reg" "00")
|
||||
(match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))"))
|
||||
(match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), -1 << 15, (1 << 15)-1)"))))
|
||||
(match_code "reg" "0")
|
||||
)))
|
||||
|
||||
|
36
gcc/config/msp430/msp430-c.c
Normal file
36
gcc/config/msp430/msp430-c.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* MSP430 C-specific support
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
Contributed by Red Hat, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "coretypes.h"
|
||||
#include "tm.h"
|
||||
#include "tree.h"
|
||||
#include "c-family/c-common.h"
|
||||
#include "msp430-protos.h"
|
||||
|
||||
/* Implements REGISTER_TARGET_PRAGMAS. */
|
||||
void
|
||||
msp430_register_pragmas (void)
|
||||
{
|
||||
c_register_addr_space ("__near", ADDR_SPACE_NEAR);
|
||||
if (msp430x)
|
||||
c_register_addr_space ("__far", ADDR_SPACE_FAR);
|
||||
}
|
3
gcc/config/msp430/msp430-modes.def
Normal file
3
gcc/config/msp430/msp430-modes.def
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* 20-bit address */
|
||||
PARTIAL_INT_MODE (SI);
|
||||
|
44
gcc/config/msp430/msp430-protos.h
Normal file
44
gcc/config/msp430/msp430-protos.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* Exported function prototypes from the TI MSP430 backend.
|
||||
Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_MSP430_PROTOS_H
|
||||
#define GCC_MSP430_PROTOS_H
|
||||
|
||||
void msp430_expand_eh_return (rtx);
|
||||
void msp430_expand_epilogue (int);
|
||||
void msp430_expand_helper (rtx *operands, const char *, bool);
|
||||
void msp430_expand_prologue (void);
|
||||
const char * msp430x_extendhisi (rtx *);
|
||||
void msp430_fixup_compare_operands (enum machine_mode, rtx *);
|
||||
int msp430_hard_regno_mode_ok (int, enum machine_mode);
|
||||
int msp430_hard_regno_nregs (int, enum machine_mode);
|
||||
rtx msp430_incoming_return_addr_rtx (void);
|
||||
void msp430_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
|
||||
int msp430_initial_elimination_offset (int, int);
|
||||
const char * msp430x_logical_shift_right (rtx);
|
||||
void msp430_output_labelref (FILE *, const char *);
|
||||
void msp430_register_pragmas (void);
|
||||
rtx msp430_return_addr_rtx (int);
|
||||
void msp430_split_movsi (rtx *);
|
||||
rtx msp430_subreg (enum machine_mode, rtx, enum machine_mode, int);
|
||||
rtx msp430_eh_return_stackadj_rtx (void);
|
||||
bool msp430_modes_tieable_p (enum machine_mode, enum machine_mode);
|
||||
|
||||
#endif /* GCC_MSP430_PROTOS_H */
|
1746
gcc/config/msp430/msp430.c
Normal file
1746
gcc/config/msp430/msp430.c
Normal file
File diff suppressed because it is too large
Load diff
399
gcc/config/msp430/msp430.h
Normal file
399
gcc/config/msp430/msp430.h
Normal file
|
@ -0,0 +1,399 @@
|
|||
/* GCC backend definitions for the TI MSP430 Processor
|
||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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 GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* Run-time Target Specification */
|
||||
|
||||
/* True if the MSP430x extensions are enabled. */
|
||||
#ifndef IN_LIBGCC2
|
||||
extern bool msp430x;
|
||||
#endif
|
||||
|
||||
#define TARGET_CPU_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__MSP430__"); \
|
||||
if (msp430x) \
|
||||
{ \
|
||||
builtin_define ("__MSP430X__"); \
|
||||
builtin_assert ("cpu=MSP430X"); \
|
||||
if (TARGET_LARGE) \
|
||||
builtin_define ("__MSP430X_LARGE__"); \
|
||||
} \
|
||||
else \
|
||||
builtin_assert ("cpu=MSP430"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
|
||||
|
||||
/* -lgcc is included because crtend.o needs __mspabi_func_epilog_1. */
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "crtend.o%s crtn.o%s -lgcc"
|
||||
|
||||
#define ASM_SPEC "-mP " /* Enable polymorphic instructions. */ \
|
||||
"%{mmcu=msp430x:-mmcu=msp430X;mmcu=*:-mmcu=%*} " /* Pass the MCU type on to the assembler. */ \
|
||||
"%{mrelax=-mQ} " /* Pass the relax option on to the assembler. */ \
|
||||
"%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model. */ \
|
||||
"%{ffunction-sections:-gdwarf-sections}" /* If function sections are being created then create DWARF line number sections as well. */
|
||||
|
||||
/* Enable linker section garbage collection by default, unless we
|
||||
are creating a relocatable binary (gc does not work) or debugging
|
||||
is enabled (the GDB testsuite relies upon unused entities not being deleted). */
|
||||
#define LINK_SPEC "%{mrelax:--relax} %{mlarge:%{!r:%{!g:--gc-sections}}}"
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC " \
|
||||
--start-group \
|
||||
-lc \
|
||||
-lgcc \
|
||||
%{msim:-lsim} \
|
||||
%{!msim:-lnosys} \
|
||||
--end-group \
|
||||
%{!T*: %{msim: %{mlarge:%Tmsp430xl-sim.ld}%{!mlarge:%Tmsp430-sim.ld}}%{!msim:%Tmsp430.ld}} \
|
||||
"
|
||||
|
||||
|
||||
/* Storage Layout */
|
||||
|
||||
#define BITS_BIG_ENDIAN 0
|
||||
#define BYTES_BIG_ENDIAN 0
|
||||
#define WORDS_BIG_ENDIAN 0
|
||||
|
||||
|
||||
#ifdef IN_LIBGCC2
|
||||
/* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
|
||||
#define UNITS_PER_WORD 4
|
||||
/* We have a problem with libgcc2. It only defines two versions of
|
||||
each function, one for "int" and one for "long long". Ie it assumes
|
||||
that "sizeof (int) == sizeof (long)". For the MSP430 this is not true
|
||||
and we need a third set of functions. We explicitly define
|
||||
LIBGCC2_UNITS_PER_WORD here so that it is clear that we are expecting
|
||||
to get the SI and DI versions from the libgcc2.c sources, and we
|
||||
provide our own set of HI functions, which is why this
|
||||
definition is surrounded by #ifndef..#endif. */
|
||||
#ifndef LIBGCC2_UNITS_PER_WORD
|
||||
#define LIBGCC2_UNITS_PER_WORD 4
|
||||
#endif
|
||||
#else
|
||||
/* Actual width of a word, in units (bytes). */
|
||||
#define UNITS_PER_WORD 2
|
||||
#endif
|
||||
|
||||
#define SHORT_TYPE_SIZE 16
|
||||
#define INT_TYPE_SIZE 16
|
||||
#define LONG_TYPE_SIZE 32
|
||||
#define LONG_LONG_TYPE_SIZE 64
|
||||
|
||||
#define FLOAT_TYPE_SIZE 32
|
||||
#define DOUBLE_TYPE_SIZE 64
|
||||
#define LONG_DOUBLE_TYPE_SIZE 64 /*DOUBLE_TYPE_SIZE*/
|
||||
|
||||
#define LIBGCC2_HAS_DF_MODE 1
|
||||
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
||||
|
||||
#define DEFAULT_SIGNED_CHAR 0
|
||||
|
||||
#define STRICT_ALIGNMENT 1
|
||||
#define FUNCTION_BOUNDARY 16
|
||||
#define BIGGEST_ALIGNMENT 16
|
||||
#define STACK_BOUNDARY 16
|
||||
#define PARM_BOUNDARY 8
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
|
||||
#define STACK_GROWS_DOWNWARD 1
|
||||
#define FRAME_GROWS_DOWNWARD 1
|
||||
#define FIRST_PARM_OFFSET(FNDECL) 0
|
||||
|
||||
#define MAX_REGS_PER_ADDRESS 1
|
||||
|
||||
#define Pmode (TARGET_LARGE ? PSImode : HImode)
|
||||
/* Note: 32 is a lie. Large pointers are actually 20-bits wide. But gcc
|
||||
thinks that any non-power-of-2 pointer size equates to BLKmode, which
|
||||
causes all kinds of problems... */
|
||||
#define POINTER_SIZE (TARGET_LARGE ? 32 : 16)
|
||||
#define POINTERS_EXTEND_UNSIGNED 1
|
||||
|
||||
#define ADDR_SPACE_NEAR 1
|
||||
#define ADDR_SPACE_FAR 2
|
||||
|
||||
#define REGISTER_TARGET_PRAGMAS() msp430_register_pragmas()
|
||||
|
||||
#if 1 /* XXX */
|
||||
/* Define this macro if it is advisable to hold scalars in registers
|
||||
in a wider mode than that declared by the program. In such cases,
|
||||
the value is constrained to be within the bounds of the declared
|
||||
type, but kept valid in the wider mode. The signedness of the
|
||||
extension may differ from that of the type. */
|
||||
|
||||
#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
|
||||
if (GET_MODE_CLASS (MODE) == MODE_INT \
|
||||
&& GET_MODE_SIZE (MODE) < 2) \
|
||||
(MODE) = HImode;
|
||||
#endif
|
||||
|
||||
/* Layout of Source Language Data Types */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE (TARGET_LARGE ? "long unsigned int" : "unsigned int")
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE (TARGET_LARGE ? "long int" : "int")
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "long int"
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
||||
#define FUNCTION_MODE HImode
|
||||
#define CASE_VECTOR_MODE Pmode
|
||||
#define HAS_LONG_COND_BRANCH 0
|
||||
#define HAS_LONG_UNCOND_BRANCH 0
|
||||
|
||||
#define LOAD_EXTEND_OP(M) ZERO_EXTEND
|
||||
/*#define WORD_REGISTER_OPERATIONS 1*/
|
||||
|
||||
#define MOVE_MAX 8
|
||||
#define STARTING_FRAME_OFFSET 0
|
||||
|
||||
#define INCOMING_RETURN_ADDR_RTX \
|
||||
msp430_incoming_return_addr_rtx ()
|
||||
|
||||
#define RETURN_ADDR_RTX(COUNT, FA) \
|
||||
msp430_return_addr_rtx (COUNT)
|
||||
|
||||
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
||||
|
||||
#define SLOW_BYTE_ACCESS 0
|
||||
|
||||
|
||||
/* Register Usage */
|
||||
|
||||
/* gas doesn't recognize PC (R0), SP (R1), and SR (R2) as register
|
||||
names. */
|
||||
#define REGISTER_NAMES \
|
||||
{ \
|
||||
"R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", \
|
||||
"R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", \
|
||||
"argptr" \
|
||||
}
|
||||
|
||||
enum reg_class
|
||||
{
|
||||
NO_REGS,
|
||||
R12_REGS,
|
||||
R13_REGS,
|
||||
GEN_REGS,
|
||||
ALL_REGS,
|
||||
LIM_REG_CLASSES
|
||||
};
|
||||
|
||||
#define REG_CLASS_NAMES \
|
||||
{ \
|
||||
"NO_REGS", \
|
||||
"R12_REGS", \
|
||||
"R13_REGS", \
|
||||
"GEN_REGS", \
|
||||
"ALL_REGS" \
|
||||
}
|
||||
|
||||
#define REG_CLASS_CONTENTS \
|
||||
{ \
|
||||
0x00000000, \
|
||||
0x00001000, \
|
||||
0x00002000, \
|
||||
0x0000fff2, \
|
||||
0x0001ffff \
|
||||
}
|
||||
|
||||
#define GENERAL_REGS GEN_REGS
|
||||
#define BASE_REG_CLASS GEN_REGS
|
||||
#define INDEX_REG_CLASS GEN_REGS
|
||||
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
||||
|
||||
#define PC_REGNUM 0
|
||||
#define STACK_POINTER_REGNUM 1
|
||||
#define CC_REGNUM 2
|
||||
#define FRAME_POINTER_REGNUM 4 /* not usually used, call preserved */
|
||||
#define ARG_POINTER_REGNUM 16
|
||||
#define STATIC_CHAIN_REGNUM 5 /* FIXME */
|
||||
|
||||
#define FIRST_PSEUDO_REGISTER 17
|
||||
|
||||
#define REGNO_REG_CLASS(REGNO) ((REGNO) < 17 \
|
||||
? GEN_REGS : NO_REGS)
|
||||
|
||||
#define TRAMPOLINE_SIZE 4 /* FIXME */
|
||||
#define TRAMPOLINE_ALIGNMENT 16 /* FIXME */
|
||||
|
||||
#define ELIMINABLE_REGS \
|
||||
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
|
||||
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
|
||||
{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
|
||||
|
||||
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
||||
(OFFSET) = msp430_initial_elimination_offset ((FROM), (TO))
|
||||
|
||||
|
||||
#define FUNCTION_ARG_REGNO_P(N) ((N) >= 8 && (N) < ARG_POINTER_REGNUM)
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* 1 == register can't be used by gcc, in general
|
||||
0 == register can be used by gcc, in general */
|
||||
#define FIXED_REGISTERS \
|
||||
{ \
|
||||
1,0,1,1, 0,0,0,0, \
|
||||
0,0,0,0, 0,0,0,0, \
|
||||
1, \
|
||||
}
|
||||
|
||||
/* 1 == value changes across function calls
|
||||
0 == value is the same after a call */
|
||||
/* R4 through R10 are callee-saved */
|
||||
#define CALL_USED_REGISTERS \
|
||||
{ \
|
||||
1,0,1,1, 0,0,0,0, \
|
||||
0,0,0,1, 1,1,1,1, \
|
||||
1, \
|
||||
}
|
||||
|
||||
#define REG_ALLOC_ORDER \
|
||||
{ 12, 13, 14, 15, 10, 9, 8, 7, 6, 5, 4, 11, 0, 1, 2, 3, 16 }
|
||||
/* { 11, 15, 14, 13, 12, 10, 9, 8, 7, 6, 5, 4, 0, 1, 2, 3, 16 }*/
|
||||
|
||||
#define REGNO_OK_FOR_BASE_P(regno) 1
|
||||
#define REGNO_OK_FOR_INDEX_P(regno) 1
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* These two are the current argument status. */
|
||||
char reg_used[4];
|
||||
#define CA_FIRST_REG 12
|
||||
char can_split;
|
||||
/* These two are temporaries used internally. */
|
||||
char start_reg;
|
||||
char reg_count;
|
||||
char mem_count;
|
||||
char special_p;
|
||||
} CUMULATIVE_ARGS;
|
||||
|
||||
#define INIT_CUMULATIVE_ARGS(CA, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
||||
msp430_init_cumulative_args (&CA, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS)
|
||||
|
||||
|
||||
/* FIXME */
|
||||
#define NO_PROFILE_COUNTERS 1
|
||||
#define PROFILE_BEFORE_PROLOGUE 1
|
||||
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
fprintf (FILE, "\tcall\t__mcount\n");
|
||||
|
||||
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
||||
msp430_hard_regno_nregs (REGNO, MODE)
|
||||
|
||||
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
|
||||
msp430_hard_regno_mode_ok (REGNO, MODE)
|
||||
|
||||
#define MODES_TIEABLE_P(MODE1, MODE2) \
|
||||
msp430_modes_tieable_p (MODE1, MODE2)
|
||||
|
||||
/* Exception Handling */
|
||||
|
||||
/* R12,R13,R14 - EH data
|
||||
R15 - stack adjustment */
|
||||
|
||||
#define EH_RETURN_DATA_REGNO(N) \
|
||||
(((N) < 3) ? ((N) + 12) : INVALID_REGNUM)
|
||||
|
||||
#define EH_RETURN_HANDLER_RTX \
|
||||
gen_rtx_MEM(Pmode, gen_rtx_PLUS (Pmode, gen_rtx_REG(Pmode, SP_REGNO), gen_rtx_REG (Pmode, 15)))
|
||||
|
||||
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 15)
|
||||
|
||||
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_udata4
|
||||
|
||||
|
||||
/* Stack Layout and Calling Conventions */
|
||||
|
||||
|
||||
/* Addressing Modes */
|
||||
|
||||
|
||||
|
||||
#define TEXT_SECTION_ASM_OP ".text"
|
||||
#define DATA_SECTION_ASM_OP ".data"
|
||||
#define BSS_SECTION_ASM_OP "\t.section .bss"
|
||||
|
||||
#define ASM_COMMENT_START " ;"
|
||||
#define ASM_APP_ON ""
|
||||
#define ASM_APP_OFF ""
|
||||
#define LOCAL_LABEL_PREFIX ".L"
|
||||
#undef USER_LABEL_PREFIX
|
||||
#define USER_LABEL_PREFIX ""
|
||||
|
||||
#define GLOBAL_ASM_OP "\t.global\t"
|
||||
|
||||
#define ASM_OUTPUT_LABELREF(FILE, SYM) msp430_output_labelref ((FILE), (SYM))
|
||||
|
||||
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
|
||||
fprintf (FILE, "\t.long .L%d\n", VALUE)
|
||||
|
||||
/* This is how to output an element of a case-vector that is relative.
|
||||
Note: The local label referenced by the "3b" below is emitted by
|
||||
the tablejump insn. */
|
||||
|
||||
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
|
||||
fprintf (FILE, "\t.long .L%d - 1b\n", VALUE)
|
||||
|
||||
|
||||
#define ASM_OUTPUT_ALIGN(STREAM, LOG) \
|
||||
do \
|
||||
{ \
|
||||
if ((LOG) == 0) \
|
||||
break; \
|
||||
fprintf (STREAM, "\t.balign %d\n", 1 << (LOG)); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
||||
|
||||
#undef DWARF2_ADDR_SIZE
|
||||
#define DWARF2_ADDR_SIZE 4
|
||||
|
||||
#define INCOMING_FRAME_SP_OFFSET (POINTER_SIZE / BITS_PER_UNIT)
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
|
||||
|
||||
#define DWARF2_ASM_LINE_DEBUG_INFO 1
|
||||
|
||||
/* Prevent reload (and others) from choosing HImode stack slots
|
||||
when spilling hard registers when they may contain PSImode values. */
|
||||
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO,NREGS,MODE) \
|
||||
((TARGET_LARGE && ((NREGS) <= 2)) ? PSImode : choose_hard_reg_mode ((REGNO), (NREGS), false))
|
||||
|
||||
/* Also stop GCC from thinking that it can eliminate (SUBREG:PSI (SI)). */
|
||||
#define CANNOT_CHANGE_MODE_CLASS(FROM,TO,CLASS) \
|
||||
( ((TO) == PSImode && (FROM) == SImode) \
|
||||
|| ((TO) == SImode && (FROM) == PSImode) \
|
||||
|| ((TO) == DImode && (FROM) == PSImode) \
|
||||
|| ((TO) == PSImode && (FROM) == DImode) \
|
||||
)
|
||||
|
||||
#define ACCUMULATE_OUTGOING_ARGS 1
|
1229
gcc/config/msp430/msp430.md
Normal file
1229
gcc/config/msp430/msp430.md
Normal file
File diff suppressed because it is too large
Load diff
26
gcc/config/msp430/msp430.opt
Normal file
26
gcc/config/msp430/msp430.opt
Normal file
|
@ -0,0 +1,26 @@
|
|||
msim
|
||||
Target
|
||||
Use simulator runtime
|
||||
|
||||
masm-hex
|
||||
Target Mask(ASM_HEX)
|
||||
Force assembly output to always use hex constants
|
||||
|
||||
mmcu=
|
||||
Target Joined RejectNegative Var(target_cpu)
|
||||
Specify the cpu to build for. If the name begins with 'msp430x' then the 430X instructions are enabled
|
||||
|
||||
mlarge
|
||||
Target Mask(LARGE) RejectNegative
|
||||
Select large model - 20-bit addresses/pointers
|
||||
|
||||
msmall
|
||||
Target InverseMask(LARGE) RejectNegative
|
||||
Select small model - 16-bit addresses/pointers (default)
|
||||
|
||||
mrelax
|
||||
Target Report
|
||||
Optimize opcode sizes at link time
|
||||
|
||||
mOs
|
||||
Target Undocumented Mask(OPT_SPACE)
|
80
gcc/config/msp430/predicates.md
Normal file
80
gcc/config/msp430/predicates.md
Normal file
|
@ -0,0 +1,80 @@
|
|||
;; Machine Description for TI MSP43* processors
|
||||
;; Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
;; Contributed by Red Hat.
|
||||
|
||||
;; This file is part of GCC.
|
||||
|
||||
;; GCC 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 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GCC 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 GCC; see the file COPYING3. If not see
|
||||
;; <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define_predicate "msp_volatile_memory_operand"
|
||||
(and (match_code "mem")
|
||||
(match_test ("memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0), MEM_ADDR_SPACE (op))")))
|
||||
)
|
||||
|
||||
; TRUE for any valid general operand. We do this because
|
||||
; general_operand refuses to match volatile memory refs.
|
||||
|
||||
(define_predicate "msp_general_operand"
|
||||
(ior (match_operand 0 "general_operand")
|
||||
(match_operand 0 "msp_volatile_memory_operand"))
|
||||
)
|
||||
|
||||
; Likewise for nonimmediate_operand.
|
||||
|
||||
(define_predicate "msp_nonimmediate_operand"
|
||||
(ior (match_operand 0 "nonimmediate_operand")
|
||||
(match_operand 0 "msp_volatile_memory_operand"))
|
||||
)
|
||||
|
||||
(define_predicate "ubyte_operand"
|
||||
(and (match_code "const_int")
|
||||
(match_test "IN_RANGE (INTVAL (op), 0, 255)")))
|
||||
|
||||
; TRUE for comparisons we support.
|
||||
(define_predicate "msp430_cmp_operator"
|
||||
(match_code "eq,ne,lt,ltu,ge,geu"))
|
||||
|
||||
; TRUE for comparisons we need to reverse.
|
||||
(define_predicate "msp430_reversible_cmp_operator"
|
||||
(match_code "gt,gtu,le,leu"))
|
||||
|
||||
; TRUE for constants the constant generator can produce
|
||||
(define_predicate "msp430_constgen_operator"
|
||||
(and (match_code "const_int")
|
||||
(match_test (" INTVAL (op) == 0
|
||||
|| INTVAL (op) == 1
|
||||
|| INTVAL (op) == 2
|
||||
|| INTVAL (op) == 4
|
||||
|| INTVAL (op) == 8
|
||||
|| INTVAL (op) == -1 "))))
|
||||
|
||||
; TRUE for constants the constant generator can produce
|
||||
(define_predicate "msp430_inv_constgen_operator"
|
||||
(and (match_code "const_int")
|
||||
(match_test (" INTVAL (op) == ~0
|
||||
|| INTVAL (op) == ~1
|
||||
|| INTVAL (op) == ~2
|
||||
|| INTVAL (op) == ~4
|
||||
|| INTVAL (op) == ~8
|
||||
|| INTVAL (op) == ~(-1) "))))
|
||||
|
||||
(define_predicate "msp430_nonsubreg_operand"
|
||||
(match_code "reg,mem"))
|
||||
|
||||
; TRUE for constants which are bit positions for zero_extract
|
||||
(define_predicate "msp430_bitpos"
|
||||
(and (match_code "const_int")
|
||||
(match_test (" INTVAL (op) >= 0
|
||||
&& INTVAL (op) <= 15 "))))
|
43
gcc/config/msp430/t-msp430
Normal file
43
gcc/config/msp430/t-msp430
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Makefile fragment for building GCC for the TI MSP430 target.
|
||||
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
# Contributed by Red Hat.
|
||||
#
|
||||
# This file is part of GCC.
|
||||
#
|
||||
# GCC 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 3, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# GCC 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 GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Enable multilibs:
|
||||
|
||||
MULTILIB_OPTIONS = mmcu=msp430x mlarge
|
||||
MULTILIB_DIRNAMES = 430x large
|
||||
|
||||
# Match msp430X with msp430x.
|
||||
MULTILIB_MATCHES = mmcu?msp430x=mmcu?msp430X
|
||||
|
||||
# each supported MCU needs a line like this:
|
||||
# MULTILIB_MATCHES += mmcu?msp430x123=mmcu?msp430x
|
||||
|
||||
# The only way I figured this out was to hack the script to SHOW me
|
||||
# what it's doing. It's non-obvious, but it matches the directory
|
||||
# structure of the multilib tree, but using the options, not the
|
||||
# directory names. A shell CASE statement is generated from these, so
|
||||
# the usual CASE wildcards are supported.
|
||||
|
||||
MULTILIB_EXCEPTIONS = mlarge
|
||||
|
||||
MULTILIB_EXTRA_OPTS =
|
||||
|
||||
msp430-c.o: $(srcdir)/config/msp430/msp430-c.c $(RTL_H) $(TREE_H) $(CONFIG_H) $(TM_H)
|
||||
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
|
|
@ -176,7 +176,7 @@ The @uref{http://www.gnu.org/software/classpath/,,GNU Classpath project}
|
|||
for all of their merged runtime code.
|
||||
|
||||
@item
|
||||
Nick Clifton for arm, mcore, fr30, v850, m32r, rx work,
|
||||
Nick Clifton for arm, mcore, fr30, v850, m32r, msp430 rx work,
|
||||
@option{--help}, and other random hacking.
|
||||
|
||||
@item
|
||||
|
@ -218,7 +218,7 @@ Mo DeJong for GCJ and libgcj bug fixes.
|
|||
|
||||
@item
|
||||
DJ Delorie for the DJGPP port, build and libiberty maintenance,
|
||||
various bug fixes, and the M32C, MeP, and RL78 ports.
|
||||
various bug fixes, and the M32C, MeP, MSP430, and RL78 ports.
|
||||
|
||||
@item
|
||||
Arnaud Desitter for helping to debug GNU Fortran.
|
||||
|
|
|
@ -3989,6 +3989,13 @@ the O32 ABI.
|
|||
@heading @anchor{moxie-x-elf}moxie-*-elf
|
||||
The moxie processor.
|
||||
|
||||
@html
|
||||
<hr />
|
||||
@end html
|
||||
@heading @anchor{msp430-x-elf}msp430-*-elf
|
||||
TI MSP430 processor.
|
||||
This configuration is intended for embedded systems.
|
||||
|
||||
@html
|
||||
<hr />
|
||||
@end html
|
||||
|
|
|
@ -804,6 +804,9 @@ Objective-C and Objective-C++ Dialects}.
|
|||
@emph{Moxie Options}
|
||||
@gccoptlist{-meb -mel -mno-crt0}
|
||||
|
||||
@emph{MSP430 Options}
|
||||
@gccoptlist{-msim -masm-hex -mmcu= -mlarge -msmall -mrelax}
|
||||
|
||||
@emph{PDP-11 Options}
|
||||
@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
|
||||
-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
|
||||
|
@ -11036,6 +11039,7 @@ platform.
|
|||
* MMIX Options::
|
||||
* MN10300 Options::
|
||||
* Moxie Options::
|
||||
* MSP430 Options::
|
||||
* PDP-11 Options::
|
||||
* picoChip Options::
|
||||
* PowerPC Options::
|
||||
|
@ -16026,7 +16030,7 @@ Link the SDRAM-based runtime instead of the default ROM-based runtime.
|
|||
|
||||
@item -msim
|
||||
@opindex msim
|
||||
Link the simulator runtime libraries.
|
||||
Link the simulator run-time libraries.
|
||||
|
||||
@item -msimnovec
|
||||
@opindex msimnovec
|
||||
|
@ -17290,6 +17294,46 @@ Do not link in the C run-time initialization object file.
|
|||
|
||||
@end table
|
||||
|
||||
@node MSP430 Options
|
||||
@subsection MSP430 Options
|
||||
@cindex MSP430 Options
|
||||
|
||||
These options are defined for the MSP430:
|
||||
|
||||
@table @gcctabopt
|
||||
|
||||
@item -msim
|
||||
@opindex msim
|
||||
Link the simulator runtime libraries.
|
||||
|
||||
@item -masm-hex
|
||||
@opindex masm-hex
|
||||
Force assembly output to always use hex constants. Normally such
|
||||
constants are signed decimals, but this option is available for
|
||||
testsuite and/or aesthetic purposes.
|
||||
|
||||
@item -mmcu=
|
||||
@opindex mmcu=
|
||||
Select the MCU to target. Note that there are two ``generic'' MCUs,
|
||||
@code{msp430} and @code{msp430x}, which should be used most of the
|
||||
time. This option is also passed to the assembler.
|
||||
|
||||
@item -mlarge
|
||||
@opindex mlarge
|
||||
Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
|
||||
|
||||
@item -msmall
|
||||
@opindex msmall
|
||||
Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
|
||||
|
||||
@item -mrelax
|
||||
@opindex mrelax
|
||||
This option is passed to the assembler and linker, and allows the
|
||||
linker to perform certain optimizations that cannot be done until
|
||||
the final link.
|
||||
|
||||
@end table
|
||||
|
||||
@node PDP-11 Options
|
||||
@subsection PDP-11 Options
|
||||
@cindex PDP-11 Options
|
||||
|
|
|
@ -3063,6 +3063,35 @@ A constant in the range of 0 to @minus{}255.
|
|||
|
||||
@end table
|
||||
|
||||
@item MSP430--@file{config/msp430/constraints.md}
|
||||
@table @code
|
||||
|
||||
@item R12
|
||||
Register R12.
|
||||
|
||||
@item R13
|
||||
Register R13.
|
||||
|
||||
@item K
|
||||
Integer constant 1.
|
||||
|
||||
@item L
|
||||
Integer constant -1^20..1^19.
|
||||
|
||||
@item M
|
||||
Integer constant 1-4.
|
||||
|
||||
@item Ya
|
||||
Memory references which do not require an extended MOVX instruction.
|
||||
|
||||
@item Yl
|
||||
Memory reference, labels only.
|
||||
|
||||
@item Ys
|
||||
Memory reference, stack only.
|
||||
|
||||
@end table
|
||||
|
||||
@item PDP-11---@file{config/pdp11/constraints.md}
|
||||
@table @code
|
||||
@item a
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-09-12 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config.host (msp*-*-elf): New.
|
||||
* config/msp430/: New port.
|
||||
|
||||
2013-08-18 Iain Sandoe <iain@codesourcery.com>
|
||||
|
||||
PR gcov-profile/58127
|
||||
|
|
|
@ -831,6 +831,9 @@ moxie-*-rtems*)
|
|||
# Don't use default.
|
||||
extra_parts=
|
||||
;;
|
||||
msp430*-*-elf)
|
||||
tmake_file="$tm_file t-crtstuff t-fdpbit msp430/t-msp430"
|
||||
;;
|
||||
pdp11-*-*)
|
||||
tmake_file="pdp11/t-pdp11 t-fdpbit"
|
||||
;;
|
||||
|
|
19
libgcc/config/msp430/cmpd.c
Normal file
19
libgcc/config/msp430/cmpd.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* Public domain. */
|
||||
int
|
||||
__mspabi_cmpf (float x, float y)
|
||||
{
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
int
|
||||
__mspabi_cmpd (double x, double y)
|
||||
{
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
98
libgcc/config/msp430/cmpsi2.S
Normal file
98
libgcc/config/msp430/cmpsi2.S
Normal file
|
@ -0,0 +1,98 @@
|
|||
; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
; Contributed by Red Hat.
|
||||
;
|
||||
; This file 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 3, or (at your option) any
|
||||
; later version.
|
||||
;
|
||||
; This file 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.
|
||||
;
|
||||
; Under Section 7 of GPL version 3, you are granted additional
|
||||
; permissions described in the GCC Runtime Library Exception, version
|
||||
; 3.1, as published by the Free Software Foundation.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License and
|
||||
; a copy of the GCC Runtime Library Exception along with this program;
|
||||
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifdef __MSP430X_LARGE__
|
||||
#define ret_ RETA
|
||||
#else
|
||||
#define ret_ RET
|
||||
#endif
|
||||
|
||||
.text
|
||||
|
||||
;; int __cmpsi2 (signed long A, signed long B)
|
||||
;;
|
||||
;; Performs a signed comparison of A and B.
|
||||
;; If A is less than B it returns 0. If A is greater
|
||||
;; than B it returns 2. If they are equal it returns 1.
|
||||
|
||||
;; Note - this code is also used by the __ucmpsi2 routine below.
|
||||
|
||||
.global __cmpsi2
|
||||
.type __cmpsi2, @function
|
||||
__cmpsi2:
|
||||
;; A is in r12 (low), r13 (high)
|
||||
;; B is in r14 (low), r15 (high)
|
||||
;; Result put in r12
|
||||
|
||||
cmp.w r13, r15
|
||||
jeq .L_compare_low
|
||||
jge .L_less_than
|
||||
.L_greater_than:
|
||||
mov.w #2, r12
|
||||
ret_
|
||||
.L_less_than:
|
||||
mov.w #0, r12
|
||||
ret_
|
||||
|
||||
.L_compare_low:
|
||||
cmp.w r12, r14
|
||||
jl .L_greater_than
|
||||
jne .L_less_than
|
||||
mov.w #1, r12
|
||||
ret_
|
||||
|
||||
.size __cmpsi2, . - __cmpsi2
|
||||
|
||||
|
||||
;; int __ucmpsi2 (unsigned long A, unsigned long B)
|
||||
;;
|
||||
;; Performs an unsigned comparison of A and B.
|
||||
;; If A is less than B it returns 0. If A is greater
|
||||
;; than B it returns 2. If they are equal it returns 1.
|
||||
|
||||
;;; Note - this function branches into the __cmpsi2 code above.
|
||||
|
||||
.global __ucmpsi2
|
||||
.type __ucmpsi2, @function
|
||||
__ucmpsi2:
|
||||
;; A is in r12 (low), r13 (high)
|
||||
;; B is in r14 (low), r15 (high)
|
||||
;; Result put in r12
|
||||
|
||||
tst r13
|
||||
jn .L_top_bit_set_in_A
|
||||
tst r15
|
||||
;;; If the top bit of B is set, but A's is clear we know that A < B.
|
||||
jn .L_less_than
|
||||
;;; Neither A nor B has their top bit set so we can use the __cmpsi2 routine.
|
||||
;;; Note we use Jc rather than BR as that saves two bytes. The TST insn always
|
||||
;;; sets the C bit.
|
||||
jc __cmpsi2
|
||||
|
||||
.L_top_bit_set_in_A:
|
||||
tst r15
|
||||
;;; If both A and B have their top bit set we can use the __cmpsi2 routine.
|
||||
jn __cmpsi2
|
||||
;;; Otherwise A has its top bit set and B does not so A > B.
|
||||
jc .L_greater_than
|
||||
|
||||
.size __ucmpsi2, . - __ucmpsi2
|
51
libgcc/config/msp430/epilogue.S
Normal file
51
libgcc/config/msp430/epilogue.S
Normal file
|
@ -0,0 +1,51 @@
|
|||
; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
; Contributed by Red Hat.
|
||||
;
|
||||
; This file 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 3, or (at your option) any
|
||||
; later version.
|
||||
;
|
||||
; This file 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.
|
||||
;
|
||||
; Under Section 7 of GPL version 3, you are granted additional
|
||||
; permissions described in the GCC Runtime Library Exception, version
|
||||
; 3.1, as published by the Free Software Foundation.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License and
|
||||
; a copy of the GCC Runtime Library Exception along with this program;
|
||||
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
.text
|
||||
|
||||
.global __mspabi_func_epilog_7
|
||||
.global __mspabi_func_epilog_6
|
||||
.global __mspabi_func_epilog_5
|
||||
.global __mspabi_func_epilog_4
|
||||
.global __mspabi_func_epilog_3
|
||||
.global __mspabi_func_epilog_2
|
||||
.global __mspabi_func_epilog_1
|
||||
|
||||
__mspabi_func_epilog_7:
|
||||
POP R4
|
||||
__mspabi_func_epilog_6:
|
||||
POP R5
|
||||
__mspabi_func_epilog_5:
|
||||
POP R6
|
||||
__mspabi_func_epilog_4:
|
||||
POP R7
|
||||
__mspabi_func_epilog_3:
|
||||
POP R8
|
||||
__mspabi_func_epilog_2:
|
||||
POP R9
|
||||
__mspabi_func_epilog_1:
|
||||
POP R10
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
8
libgcc/config/msp430/floathidf.c
Normal file
8
libgcc/config/msp430/floathidf.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* Public domain. */
|
||||
extern double __floatsidf (long);
|
||||
|
||||
double
|
||||
__floathidf (int u)
|
||||
{
|
||||
return __floatsidf ((long)u);
|
||||
}
|
11
libgcc/config/msp430/floathisf.c
Normal file
11
libgcc/config/msp430/floathisf.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* Public domain. */
|
||||
typedef int HItype __attribute__ ((mode (HI)));
|
||||
typedef float SFtype __attribute__ ((mode (SF)));
|
||||
|
||||
extern SFtype __floatsisf (unsigned long);
|
||||
|
||||
SFtype
|
||||
__floathisf (HItype u)
|
||||
{
|
||||
return __floatsisf ((unsigned long)u);
|
||||
}
|
12
libgcc/config/msp430/floatunhidf.c
Normal file
12
libgcc/config/msp430/floatunhidf.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* Public domain. */
|
||||
typedef int HItype __attribute__ ((mode (HI)));
|
||||
typedef unsigned int UHItype __attribute__ ((mode (HI)));
|
||||
typedef float DFtype __attribute__ ((mode (DF)));
|
||||
|
||||
extern DFtype __floatunsidf (unsigned long);
|
||||
|
||||
DFtype
|
||||
__floatunhidf (UHItype u)
|
||||
{
|
||||
return __floatunsidf ((unsigned long)u);
|
||||
}
|
12
libgcc/config/msp430/floatunhisf.c
Normal file
12
libgcc/config/msp430/floatunhisf.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* Public domain. */
|
||||
typedef int HItype __attribute__ ((mode (HI)));
|
||||
typedef unsigned int UHItype __attribute__ ((mode (HI)));
|
||||
typedef float SFtype __attribute__ ((mode (SF)));
|
||||
|
||||
extern SFtype __floatunsisf (unsigned long);
|
||||
|
||||
SFtype
|
||||
__floatunhisf (UHItype u)
|
||||
{
|
||||
return __floatunsisf ((unsigned long)u);
|
||||
}
|
50
libgcc/config/msp430/lib2bitcountHI.c
Normal file
50
libgcc/config/msp430/lib2bitcountHI.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* libgcc routines for MSP430
|
||||
Copyright (C) 2012
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef int sint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef int sint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
typedef int sint08_type __attribute__ ((mode (QI)));
|
||||
typedef unsigned int uint08_type __attribute__ ((mode (QI)));
|
||||
typedef int word_type __attribute__ ((mode (__word__)));
|
||||
|
||||
#define C3B(a,b,c) a##b##c
|
||||
#define C3(a,b,c) C3B(a,b,c)
|
||||
|
||||
/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
|
||||
msp430.h for why we are creating extra versions of some of the
|
||||
functions defined in libgcc2.c. */
|
||||
|
||||
#define LIBGCC2_UNITS_PER_WORD 2
|
||||
|
||||
#define L_clzsi2
|
||||
#define L_ctzsi2
|
||||
#define L_ffssi2
|
||||
#define L_paritysi2
|
||||
#define L_popcountsi2
|
||||
|
||||
#include "libgcc2.c"
|
43
libgcc/config/msp430/lib2divHI.c
Normal file
43
libgcc/config/msp430/lib2divHI.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* HI mode divide routines for libgcc for MSP430
|
||||
Copyright (C) 2012
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef int sint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef int sint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
typedef int sint08_type __attribute__ ((mode (QI)));
|
||||
typedef unsigned int uint08_type __attribute__ ((mode (QI)));
|
||||
typedef int word_type __attribute__ ((mode (__word__)));
|
||||
|
||||
#define C3B(a,b,c) a##b##c
|
||||
#define C3(a,b,c) C3B(a,b,c)
|
||||
|
||||
#define UINT_TYPE uint16_type
|
||||
#define SINT_TYPE sint16_type
|
||||
#define BITS_MINUS_1 15
|
||||
#define NAME_MODE hi
|
||||
|
||||
#include "msp430-divmod.h"
|
44
libgcc/config/msp430/lib2divQI.c
Normal file
44
libgcc/config/msp430/lib2divQI.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* QI mode divide routines for libgcc for MSP430
|
||||
Copyright (C) 2012
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef int sint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef int sint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
typedef int sint08_type __attribute__ ((mode (QI)));
|
||||
typedef unsigned int uint08_type __attribute__ ((mode (QI)));
|
||||
typedef int word_type __attribute__ ((mode (__word__)));
|
||||
|
||||
#define C3B(a,b,c) a##b##c
|
||||
#define C3(a,b,c) C3B(a,b,c)
|
||||
|
||||
#define UINT_TYPE uint08_type
|
||||
#define SINT_TYPE sint08_type
|
||||
#define BITS_MINUS_1 7
|
||||
#define NAME_MODE qi
|
||||
|
||||
#include "msp430-divmod.h"
|
||||
|
43
libgcc/config/msp430/lib2divSI.c
Normal file
43
libgcc/config/msp430/lib2divSI.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* SI mode divide routines for libgcc for MSP430
|
||||
Copyright (C) 2012
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef int sint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef int sint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
typedef int sint08_type __attribute__ ((mode (QI)));
|
||||
typedef unsigned int uint08_type __attribute__ ((mode (QI)));
|
||||
typedef int word_type __attribute__ ((mode (__word__)));
|
||||
|
||||
#define C3B(a,b,c) a##b##c
|
||||
#define C3(a,b,c) C3B(a,b,c)
|
||||
|
||||
#define UINT_TYPE uint32_type
|
||||
#define SINT_TYPE sint32_type
|
||||
#define BITS_MINUS_1 31
|
||||
#define NAME_MODE si
|
||||
|
||||
#include "msp430-divmod.h"
|
59
libgcc/config/msp430/lib2mul.c
Normal file
59
libgcc/config/msp430/lib2mul.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* libgcc routines for MSP430
|
||||
Copyright (C) 2005, 2009, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint08_type __attribute__ ((mode (QI)));
|
||||
|
||||
#define C3B(a,b,c) a##b##c
|
||||
#define C3(a,b,c) C3B(a,b,c)
|
||||
|
||||
|
||||
#define UINT_TYPE uint16_type
|
||||
#define BITS_MINUS_1 15
|
||||
#define NAME_MODE hi
|
||||
|
||||
#include "msp430-mul.h"
|
||||
|
||||
#undef UINT_TYPE
|
||||
#undef BITS_MINUS_1
|
||||
#undef NAME_MODE
|
||||
|
||||
#define UINT_TYPE uint08_type
|
||||
#define BITS_MINUS_1 7
|
||||
#define NAME_MODE qi
|
||||
|
||||
#include "msp430-mul.h"
|
||||
|
||||
#undef UINT_TYPE
|
||||
#undef BITS_MINUS_1
|
||||
#undef NAME_MODE
|
||||
|
||||
#define UINT_TYPE uint32_type
|
||||
#define BITS_MINUS_1 31
|
||||
#define NAME_MODE si
|
||||
|
||||
#include "msp430-mul.h"
|
113
libgcc/config/msp430/lib2shift.c
Normal file
113
libgcc/config/msp430/lib2shift.c
Normal file
|
@ -0,0 +1,113 @@
|
|||
/* Shift functions for the GCC support library for the MSP430
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
typedef int sint32_type __attribute__ ((mode (SI)));
|
||||
typedef unsigned int uint32_type __attribute__ ((mode (SI)));
|
||||
typedef int sint16_type __attribute__ ((mode (HI)));
|
||||
typedef unsigned int uint16_type __attribute__ ((mode (HI)));
|
||||
|
||||
uint32_type __ashlsi3 (uint32_type in, char bit);
|
||||
sint32_type __ashrsi3 (sint32_type in, char bit);
|
||||
int __clrsbhi2 (sint16_type x);
|
||||
extern int __clrsbsi2 (sint32_type x);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32_type u;
|
||||
uint16_type h[2];
|
||||
} u;
|
||||
} dd;
|
||||
|
||||
uint32_type
|
||||
__ashlsi3 (uint32_type in, char bit)
|
||||
{
|
||||
uint16_type h, l;
|
||||
dd d;
|
||||
|
||||
if (bit > 32)
|
||||
return 0;
|
||||
if (bit < 0)
|
||||
return in;
|
||||
|
||||
d.u.u = in;
|
||||
h = d.u.h[1];
|
||||
l = d.u.h[0];
|
||||
|
||||
if (bit > 15)
|
||||
{
|
||||
h = l;
|
||||
l = 0;
|
||||
bit -= 16;
|
||||
}
|
||||
|
||||
while (bit)
|
||||
{
|
||||
h = (h << 1) | (l >> 15);
|
||||
l <<= 1;
|
||||
bit --;
|
||||
}
|
||||
|
||||
d.u.h[1] = h;
|
||||
d.u.h[0] = l;
|
||||
return d.u.u;
|
||||
}
|
||||
|
||||
sint32_type
|
||||
__ashrsi3 (sint32_type in, char bit)
|
||||
{
|
||||
sint16_type h;
|
||||
uint16_type l;
|
||||
dd d;
|
||||
|
||||
if (bit > 32)
|
||||
return 0;
|
||||
if (bit < 0)
|
||||
return in;
|
||||
|
||||
d.u.u = in;
|
||||
h = d.u.h[1];
|
||||
l = d.u.h[0];
|
||||
|
||||
while (bit)
|
||||
{
|
||||
l = (h << 15) | (l >> 1);
|
||||
h >>= 1;
|
||||
bit --;
|
||||
}
|
||||
|
||||
d.u.h[1] = h;
|
||||
d.u.h[0] = l;
|
||||
return d.u.u;
|
||||
}
|
||||
|
||||
int
|
||||
__clrsbhi2 (sint16_type x)
|
||||
{
|
||||
if (x == 0)
|
||||
return 15;
|
||||
return __clrsbsi2 ((sint32_type) x) - 16;
|
||||
}
|
15
libgcc/config/msp430/mpy.c
Normal file
15
libgcc/config/msp430/mpy.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* Public domain. */
|
||||
extern int __mulhi3 (int, int);
|
||||
|
||||
int
|
||||
__mulhi3 (int x, int y)
|
||||
{
|
||||
volatile int rv = 0;
|
||||
|
||||
while (y > 0)
|
||||
{
|
||||
rv += x;
|
||||
y --;
|
||||
}
|
||||
return rv;
|
||||
}
|
118
libgcc/config/msp430/msp430-divmod.h
Normal file
118
libgcc/config/msp430/msp430-divmod.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/* libgcc routines for MSP430
|
||||
Copyright (C) 2005, 2009, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
UINT_TYPE C3(udivmod,NAME_MODE,4) (UINT_TYPE, UINT_TYPE, word_type);
|
||||
SINT_TYPE C3(__div,NAME_MODE,3) (SINT_TYPE, SINT_TYPE);
|
||||
SINT_TYPE C3(__mod,NAME_MODE,3) (SINT_TYPE, SINT_TYPE);
|
||||
UINT_TYPE C3(__udiv,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
|
||||
UINT_TYPE C3(__umod,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
|
||||
|
||||
UINT_TYPE
|
||||
C3(udivmod,NAME_MODE,4) (UINT_TYPE num, UINT_TYPE den, word_type modwanted)
|
||||
{
|
||||
UINT_TYPE bit = 1;
|
||||
UINT_TYPE res = 0;
|
||||
|
||||
while (den < num && bit && !(den & (1L << BITS_MINUS_1)))
|
||||
{
|
||||
den <<= 1;
|
||||
bit <<= 1;
|
||||
}
|
||||
while (bit)
|
||||
{
|
||||
if (num >= den)
|
||||
{
|
||||
num -= den;
|
||||
res |= bit;
|
||||
}
|
||||
bit >>= 1;
|
||||
den >>= 1;
|
||||
}
|
||||
if (modwanted)
|
||||
return num;
|
||||
return res;
|
||||
}
|
||||
|
||||
SINT_TYPE
|
||||
C3(__div,NAME_MODE,3) (SINT_TYPE a, SINT_TYPE b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
SINT_TYPE res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
{
|
||||
b = -b;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
res = C3(udivmod,NAME_MODE,4) (a, b, 0);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
SINT_TYPE
|
||||
C3(__mod,NAME_MODE,3) (SINT_TYPE a, SINT_TYPE b)
|
||||
{
|
||||
word_type neg = 0;
|
||||
SINT_TYPE res;
|
||||
|
||||
if (a < 0)
|
||||
{
|
||||
a = -a;
|
||||
neg = 1;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
|
||||
res = C3(udivmod,NAME_MODE,4) (a, b, 1);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
UINT_TYPE
|
||||
C3(__udiv,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
|
||||
{
|
||||
return C3(udivmod,NAME_MODE,4) (a, b, 0);
|
||||
}
|
||||
|
||||
UINT_TYPE
|
||||
C3(__umod,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
|
||||
{
|
||||
return C3(udivmod,NAME_MODE,4) (a, b, 1);
|
||||
}
|
43
libgcc/config/msp430/msp430-mul.h
Normal file
43
libgcc/config/msp430/msp430-mul.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* libgcc routines for RL78
|
||||
Copyright (C) 2005, 2009, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Red Hat.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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 3, or (at your
|
||||
option) any later version.
|
||||
|
||||
GCC 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.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
UINT_TYPE C3(__mul,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
|
||||
UINT_TYPE
|
||||
C3(__mul,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
|
||||
{
|
||||
UINT_TYPE rv = 0;
|
||||
|
||||
char bit;
|
||||
|
||||
for (bit=0; b && bit<sizeof(UINT_TYPE)*8; bit++)
|
||||
{
|
||||
if (b & 1)
|
||||
rv += a;
|
||||
a <<= 1;
|
||||
b >>= 1;
|
||||
}
|
||||
return rv;
|
||||
}
|
108
libgcc/config/msp430/slli.S
Normal file
108
libgcc/config/msp430/slli.S
Normal file
|
@ -0,0 +1,108 @@
|
|||
; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
; Contributed by Red Hat.
|
||||
;
|
||||
; This file 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 3, or (at your option) any
|
||||
; later version.
|
||||
;
|
||||
; This file 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.
|
||||
;
|
||||
; Under Section 7 of GPL version 3, you are granted additional
|
||||
; permissions described in the GCC Runtime Library Exception, version
|
||||
; 3.1, as published by the Free Software Foundation.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License and
|
||||
; a copy of the GCC Runtime Library Exception along with this program;
|
||||
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
.text
|
||||
|
||||
/* Logical Left Shift - R12 -> R12 */
|
||||
|
||||
.macro _slli n
|
||||
.global __mspabi_slli_\n
|
||||
__mspabi_slli_\n:
|
||||
ADD.W R12,R12
|
||||
.endm
|
||||
|
||||
_slli 15
|
||||
_slli 14
|
||||
_slli 13
|
||||
_slli 12
|
||||
_slli 11
|
||||
_slli 10
|
||||
_slli 9
|
||||
_slli 8
|
||||
_slli 7
|
||||
_slli 6
|
||||
_slli 5
|
||||
_slli 4
|
||||
_slli 3
|
||||
_slli 2
|
||||
_slli 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R13
|
||||
ADD.W R12,R12
|
||||
.global __mspabi_slli
|
||||
__mspabi_slli:
|
||||
CMP #0,R13
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
/* Logical Left Shift - R12:R13 -> R12:R13 */
|
||||
|
||||
.macro _slll n
|
||||
.global __mspabi_slll_\n
|
||||
__mspabi_slll_\n:
|
||||
ADD.W R12,R12
|
||||
ADDC.W R13,R13
|
||||
.endm
|
||||
|
||||
_slll 15
|
||||
_slll 14
|
||||
_slll 13
|
||||
_slll 12
|
||||
_slll 11
|
||||
_slll 10
|
||||
_slll 9
|
||||
_slll 8
|
||||
_slll 7
|
||||
_slll 6
|
||||
_slll 5
|
||||
_slll 4
|
||||
_slll 3
|
||||
_slll 2
|
||||
_slll 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R14
|
||||
ADD.W R12,R12
|
||||
ADDC.W R13,R13
|
||||
.global __mspabi_slll
|
||||
__mspabi_slll:
|
||||
CMP #0,R14
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
106
libgcc/config/msp430/srai.S
Normal file
106
libgcc/config/msp430/srai.S
Normal file
|
@ -0,0 +1,106 @@
|
|||
; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
; Contributed by Red Hat.
|
||||
;
|
||||
; This file 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 3, or (at your option) any
|
||||
; later version.
|
||||
;
|
||||
; This file 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.
|
||||
;
|
||||
; Under Section 7 of GPL version 3, you are granted additional
|
||||
; permissions described in the GCC Runtime Library Exception, version
|
||||
; 3.1, as published by the Free Software Foundation.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License and
|
||||
; a copy of the GCC Runtime Library Exception along with this program;
|
||||
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
.text
|
||||
|
||||
.macro _srai n
|
||||
.global __mspabi_srai_\n
|
||||
__mspabi_srai_\n:
|
||||
RRA.W R12
|
||||
.endm
|
||||
|
||||
/* Logical Right Shift - R12 -> R12 */
|
||||
_srai 15
|
||||
_srai 14
|
||||
_srai 13
|
||||
_srai 12
|
||||
_srai 11
|
||||
_srai 10
|
||||
_srai 9
|
||||
_srai 8
|
||||
_srai 7
|
||||
_srai 6
|
||||
_srai 5
|
||||
_srai 4
|
||||
_srai 3
|
||||
_srai 2
|
||||
_srai 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R13
|
||||
RRA.W R12,R12
|
||||
.global __mspabi_srai
|
||||
__mspabi_srai:
|
||||
CMP #0,R13
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
/* Logical Right Shift - R12:R13 -> R12:R13 */
|
||||
|
||||
.macro _sral n
|
||||
.global __mspabi_sral_\n
|
||||
__mspabi_sral_\n:
|
||||
RRA.W R13
|
||||
RRC.W R12
|
||||
.endm
|
||||
|
||||
_sral 15
|
||||
_sral 14
|
||||
_sral 13
|
||||
_sral 12
|
||||
_sral 11
|
||||
_sral 10
|
||||
_sral 9
|
||||
_sral 8
|
||||
_sral 7
|
||||
_sral 6
|
||||
_sral 5
|
||||
_sral 4
|
||||
_sral 3
|
||||
_sral 2
|
||||
_sral 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R14
|
||||
RRA.W R13
|
||||
RRC.W R12
|
||||
.global __mspabi_sral
|
||||
__mspabi_sral:
|
||||
CMP #0,R14
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
110
libgcc/config/msp430/srli.S
Normal file
110
libgcc/config/msp430/srli.S
Normal file
|
@ -0,0 +1,110 @@
|
|||
; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
||||
; Contributed by Red Hat.
|
||||
;
|
||||
; This file 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 3, or (at your option) any
|
||||
; later version.
|
||||
;
|
||||
; This file 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.
|
||||
;
|
||||
; Under Section 7 of GPL version 3, you are granted additional
|
||||
; permissions described in the GCC Runtime Library Exception, version
|
||||
; 3.1, as published by the Free Software Foundation.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License and
|
||||
; a copy of the GCC Runtime Library Exception along with this program;
|
||||
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
; <http://www.gnu.org/licenses/>.
|
||||
|
||||
.text
|
||||
|
||||
.macro _srli n
|
||||
.global __mspabi_srli_\n
|
||||
__mspabi_srli_\n:
|
||||
CLRC
|
||||
RRC.W R12
|
||||
.endm
|
||||
|
||||
/* Logical Right Shift - R12 -> R12 */
|
||||
_srli 15
|
||||
_srli 14
|
||||
_srli 13
|
||||
_srli 12
|
||||
_srli 11
|
||||
_srli 10
|
||||
_srli 9
|
||||
_srli 8
|
||||
_srli 7
|
||||
_srli 6
|
||||
_srli 5
|
||||
_srli 4
|
||||
_srli 3
|
||||
_srli 2
|
||||
_srli 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R13
|
||||
CLRC
|
||||
RRC.W R12,R12
|
||||
.global __mspabi_srli
|
||||
__mspabi_srli:
|
||||
CMP #0,R13
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
/* Logical Right Shift - R12:R13 -> R12:R13 */
|
||||
|
||||
.macro _srll n
|
||||
.global __mspabi_srll_\n
|
||||
__mspabi_srll_\n:
|
||||
CLRC
|
||||
RRC.W R13
|
||||
RRC.W R12
|
||||
.endm
|
||||
|
||||
_srll 15
|
||||
_srll 14
|
||||
_srll 13
|
||||
_srll 12
|
||||
_srll 11
|
||||
_srll 10
|
||||
_srll 9
|
||||
_srll 8
|
||||
_srll 7
|
||||
_srll 6
|
||||
_srll 5
|
||||
_srll 4
|
||||
_srll 3
|
||||
_srll 2
|
||||
_srll 1
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
||||
|
||||
1: ADD.W #-1,R14
|
||||
CLRC
|
||||
RRC.W R13
|
||||
RRC.W R12
|
||||
.global __mspabi_srll
|
||||
__mspabi_srll:
|
||||
CMP #0,R14
|
||||
JNZ 1b
|
||||
#ifdef __MSP430X_LARGE__
|
||||
RETA
|
||||
#else
|
||||
RET
|
||||
#endif
|
48
libgcc/config/msp430/t-msp430
Normal file
48
libgcc/config/msp430/t-msp430
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Makefile fragment for building LIBGCC for the TI MSP430 processor.
|
||||
# Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
# Contributed by Red Hat.
|
||||
#
|
||||
# This file is part of GCC.
|
||||
#
|
||||
# GCC 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 3, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# GCC 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 GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Note - we have separate versions of the lib2div<mode> files
|
||||
# as the functions are quite large and we do not want to pull
|
||||
# in unneeded division routines.
|
||||
|
||||
LIB2ADD = \
|
||||
$(srcdir)/config/msp430/lib2divQI.c \
|
||||
$(srcdir)/config/msp430/lib2divHI.c \
|
||||
$(srcdir)/config/msp430/lib2divSI.c \
|
||||
$(srcdir)/config/msp430/lib2bitcountHI.c \
|
||||
$(srcdir)/config/msp430/lib2mul.c \
|
||||
$(srcdir)/config/msp430/lib2shift.c \
|
||||
$(srcdir)/config/msp430/epilogue.S \
|
||||
$(srcdir)/config/msp430/mpy.c \
|
||||
$(srcdir)/config/msp430/slli.S \
|
||||
$(srcdir)/config/msp430/srai.S \
|
||||
$(srcdir)/config/msp430/srli.S \
|
||||
$(srcdir)/config/msp430/cmpsi2.S \
|
||||
$(srcdir)/config/msp430/floatunhisf.c \
|
||||
$(srcdir)/config/msp430/floatunhidf.c \
|
||||
$(srcdir)/config/msp430/floathidf.c \
|
||||
$(srcdir)/config/msp430/floathisf.c \
|
||||
$(srcdir)/config/msp430/cmpd.c
|
||||
|
||||
HOST_LIBGCC2_CFLAGS += -Os -ffunction-sections -fdata-sections
|
||||
|
||||
# Local Variables:
|
||||
# mode: Makefile
|
||||
# End:
|
Loading…
Add table
Reference in a new issue