diff options
author | Nick Clifton <nickc@redhat.com> | 2009-04-01 12:22:14 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2009-04-01 12:22:14 +0000 |
commit | 235e1fe81e089e2563c046260eca00144710cd67 (patch) | |
tree | 1d9f59f54ebe580d52f1cabbb41cc723f4a4ceaa | |
parent | d6868399fb67b375e562d28d2f0dcf52cbf8d9d1 (diff) | |
download | gcc-235e1fe81e089e2563c046260eca00144710cd67.zip gcc-235e1fe81e089e2563c046260eca00144710cd67.tar.gz gcc-235e1fe81e089e2563c046260eca00144710cd67.tar.bz2 |
m32c.h (LIBGCC2_UNITS_PER_WORD): Define if not already defined.
* config/m32c/m32c.h (LIBGCC2_UNITS_PER_WORD): Define if not
already defined.
* config/m32c/t-m32c (LIB2FUNCS_EXTRA): Add m32c-lib2-trapv.c.
* config/m32c/m32c-lib2.c: Remove unused typedefs. Rename the
other typedefs to avoid conflicts with libgcc2.c. Define labels
to gain 16-bit bit-manipulation functions from libgcc2.c and then
include it.
* config/m32c/m32c-lib2-trapv.c: New file. Define labels
to gain 16-bit trapping arithmetic functions from libgcc2.c and
then include it.
From-SVN: r145397
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/config/m32c/m32c-lib2.c | 64 | ||||
-rw-r--r-- | gcc/config/m32c/m32c.c | 9 | ||||
-rw-r--r-- | gcc/config/m32c/t-m32c | 2 |
4 files changed, 53 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f088788..327d33d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2009-04-01 Nick Clifton <nickc@redhat.com> + + * config/m32c/m32c.h (LIBGCC2_UNITS_PER_WORD): Define if not + already defined. + * config/m32c/t-m32c (LIB2FUNCS_EXTRA): Add m32c-lib2-trapv.c. + * config/m32c/m32c-lib2.c: Remove unused typedefs. Rename the + other typedefs to avoid conflicts with libgcc2.c. Define labels + to gain 16-bit bit-manipulation functions from libgcc2.c and then + include it. + * config/m32c/m32c-lib2-trapv.c: New file. Define labels + to gain 16-bit trapping arithmetic functions from libgcc2.c and + then include it. + 2009-04-01 Rafael Avila de Espindola <espindola@google.com> * varasm.c (default_function_rodata_section): Declare DOT as const char*. diff --git a/gcc/config/m32c/m32c-lib2.c b/gcc/config/m32c/m32c-lib2.c index 492e6c8..ff341e8 100644 --- a/gcc/config/m32c/m32c-lib2.c +++ b/gcc/config/m32c/m32c-lib2.c @@ -1,5 +1,5 @@ /* libgcc routines for R8C/M16C/M32C - Copyright (C) 2005 + Copyright (C) 2005, 2009 Free Software Foundation, Inc. Contributed by Red Hat. @@ -29,24 +29,19 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -typedef int HItype __attribute__ ((mode (HI))); -typedef unsigned int UHItype __attribute__ ((mode (HI))); -typedef int SItype __attribute__ ((mode (SI))); -typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int sint32_type __attribute__ ((mode (SI))); +typedef unsigned int uint32_type __attribute__ ((mode (SI))); +typedef int word_type __attribute__ ((mode (__word__))); -typedef int word_type __attribute__ ((mode (__word__))); +uint32_type udivmodsi4 (uint32_type, uint32_type, word_type); +sint32_type __divsi3 (sint32_type, sint32_type); +sint32_type __modsi3 (sint32_type, sint32_type); -USItype udivmodsi4 (USItype num, USItype den, word_type modwanted); -SItype __divsi3 (SItype a, SItype b); -SItype __modsi3 (SItype a, SItype b); -SItype __udivsi3 (SItype a, SItype b); -SItype __umodsi3 (SItype a, SItype b); - -USItype -udivmodsi4 (USItype num, USItype den, word_type modwanted) +uint32_type +udivmodsi4 (uint32_type num, uint32_type den, word_type modwanted) { - USItype bit = 1; - USItype res = 0; + uint32_type bit = 1; + uint32_type res = 0; while (den < num && bit && !(den & (1L << 31))) { @@ -68,13 +63,11 @@ udivmodsi4 (USItype num, USItype den, word_type modwanted) return res; } - - -SItype -__divsi3 (SItype a, SItype b) +sint32_type +__divsi3 (sint32_type a, sint32_type b) { word_type neg = 0; - SItype res; + sint32_type res; if (a < 0) { @@ -96,13 +89,11 @@ __divsi3 (SItype a, SItype b) return res; } - - -SItype -__modsi3 (SItype a, SItype b) +sint32_type +__modsi3 (sint32_type a, sint32_type b) { word_type neg = 0; - SItype res; + sint32_type res; if (a < 0) { @@ -121,19 +112,28 @@ __modsi3 (SItype a, SItype b) return res; } +/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in + m32c.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" -SItype -__udivsi3 (SItype a, SItype b) +uint32_type +__udivsi3 (uint32_type a, uint32_type b) { return udivmodsi4 (a, b, 0); } - - -SItype -__umodsi3 (SItype a, SItype b) +uint32_type +__umoddi3 (uint32_type a, uint32_type b) { return udivmodsi4 (a, b, 1); } diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 1e0cda6..5021831 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -2701,8 +2701,13 @@ m32c_print_operand_punct_valid_p (int c) void m32c_print_operand_address (FILE * stream, rtx address) { - gcc_assert (GET_CODE (address) == MEM); - m32c_print_operand (stream, XEXP (address, 0), 0); + if (GET_CODE (address) == MEM) + address = XEXP (address, 0); + else + /* cf: gcc.dg/asm-4.c. */ + gcc_assert (GET_CODE (address) == REG); + + m32c_print_operand (stream, address, 0); } /* Implements ASM_OUTPUT_REG_PUSH. Control registers are pushed diff --git a/gcc/config/m32c/t-m32c b/gcc/config/m32c/t-m32c index de2a54f..33454fe 100644 --- a/gcc/config/m32c/t-m32c +++ b/gcc/config/m32c/t-m32c @@ -29,7 +29,7 @@ LIB1ASMFUNCS = \ __m32c_ucmpsi2 \ __m32c_jsri16 -LIB2FUNCS_EXTRA = $(srcdir)/config/m32c/m32c-lib2.c +LIB2FUNCS_EXTRA = $(srcdir)/config/m32c/m32c-lib2.c $(srcdir)/config/m32c/m32c-lib2-trapv.c # floating point emulation libraries |