From fe38bf6b027e1979f35f02d2d64fec5a764c288b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 18 Jul 2013 12:15:15 +0000 Subject: * config/rx-defs.h: Add macros for RX100, RX200, RX600, and RX610. * config/rx-parse.y: (rx_check_float_support): Add function to check floating point operation support for target RX100 and RX200. * config/tc-rx.c: Add CPU options RX100, RX200, RX600, and RX610. * doc/c-rx.texi: Add -mcpu option to recognize macros for RX100, RX200, RX600, and RX610 --- gas/ChangeLog | 11 +++++++++++ gas/config/rx-defs.h | 17 +++++++++++++---- gas/config/rx-parse.y | 18 ++++++++++++------ gas/config/tc-rx.c | 24 ++++++++++++++++++++++-- gas/doc/c-rx.texi | 10 ++++++++-- 5 files changed, 66 insertions(+), 14 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 3ca1cd6151..87908d7267 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2013-07-18 Sandeep Kumar Singh + + * config/rx-defs.h: Add macros for RX100, RX200, RX600, and + RX610. + * config/rx-parse.y: (rx_check_float_support): Add function to + check floating point operation support for target RX100 and + RX200. + * config/tc-rx.c: Add CPU options RX100, RX200, RX600, and RX610. + * doc/c-rx.texi: Add -mcpu option to recognize macros for RX100, + RX200, RX600, and RX610 + 2013-07-18 Senthil Kumar Selvaraj * config/tc-avr.c (md_show_usage): Add avrxmega2 to help text diff --git a/gas/config/rx-defs.h b/gas/config/rx-defs.h index 5353cb9191..78ab4dff98 100644 --- a/gas/config/rx-defs.h +++ b/gas/config/rx-defs.h @@ -1,6 +1,5 @@ /* rx-defs.h Renesas RX internal definitions - Copyright 2008, 2009 - Free Software Foundation, Inc. + Copyright 2008-2013 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -20,7 +19,7 @@ 02110-1301, USA. */ #ifndef RX_DEFS_H -#define RX_DEFS_H +#define RX_DEFS_H /* Third operand to rx_op. */ #define RXREL_SIGNED 0 @@ -34,8 +33,17 @@ #define RX_RELAX_IMM 2 #define RX_RELAX_DISP 3 +enum rx_cpu_types +{ + RX600, + RX610, + RX200, + RX100 +}; + extern int rx_pid_register; extern int rx_gp_register; +extern enum rx_cpu_types rx_cpu; extern int rx_error (const char *); extern void rx_lex_init (char *, char *); @@ -57,4 +65,5 @@ extern int rx_wrap (void); extern char * rx_lex_start; extern char * rx_lex_end; -#endif + +#endif /* RX_DEFS_H */ diff --git a/gas/config/rx-parse.y b/gas/config/rx-parse.y index c719acc96e..09e3e84fe4 100644 --- a/gas/config/rx-parse.y +++ b/gas/config/rx-parse.y @@ -1,6 +1,5 @@ /* rx-parse.y Renesas RX parser - Copyright 2008, 2009 - Free Software Foundation, Inc. + Copyright 2008-2013 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -104,6 +103,7 @@ static int sizemap[] = { BSIZE, WSIZE, LSIZE, WSIZE }; #define id24(a,b2,b3) B3 (0xfb+a, b2, b3) +static void rx_check_float_support (void); static int rx_intop (expressionS, int, int); static int rx_uintop (expressionS, int); static int rx_disp3op (expressionS); @@ -881,17 +881,16 @@ op_shift ; - float2_op : '#' EXPR ',' REG - { id24 (2, 0x72, sub_op << 4); F ($4, 20, 4); O4 ($2); } + { rx_check_float_support (); id24 (2, 0x72, sub_op << 4); F ($4, 20, 4); O4 ($2); } | float2_op_ni ; float2_op_ni : REG ',' REG - { id24 (1, 0x83 + (sub_op << 2), 0); F ($1, 16, 4); F ($3, 20, 4); } + { rx_check_float_support (); id24 (1, 0x83 + (sub_op << 2), 0); F ($1, 16, 4); F ($3, 20, 4); } | disp '[' REG ']' opt_l ',' REG - { id24 (1, 0x80 + (sub_op << 2), 0); F ($3, 16, 4); F ($7, 20, 4); DSP ($1, 14, LSIZE); } + { rx_check_float_support (); id24 (1, 0x80 + (sub_op << 2), 0); F ($3, 16, 4); F ($7, 20, 4); DSP ($1, 14, LSIZE); } ; /* ====================================================================== */ @@ -1629,3 +1628,10 @@ rx_range (expressionS exp, int minv, int maxv) if (val < minv || val > maxv) as_warn (_("Value %d out of range %d..%d"), val, minv, maxv); } + +static void +rx_check_float_support (void) +{ + if (rx_cpu == RX100 || rx_cpu == RX200) + rx_error (_("target CPU type does not support floating point instructions")); +} diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index b1d0b20773..f15ed93c4d 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -1,6 +1,5 @@ /* tc-rx.c -- Assembler for the Renesas RX - Copyright 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright 2008-2013 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -56,6 +55,8 @@ static int rx_num_int_regs = 0; int rx_pid_register; int rx_gp_register; +enum rx_cpu_types rx_cpu = RX600; + static void rx_fetchalign (int ignore ATTRIBUTE_UNUSED); enum options @@ -72,6 +73,7 @@ enum options OPTION_INT_REGS, OPTION_USES_GCC_ABI, OPTION_USES_RX_ABI, + OPTION_CPU, }; #define RX_SHORTOPTS "" @@ -98,6 +100,7 @@ struct option md_longopts[] = {"mint-register", required_argument, NULL, OPTION_INT_REGS}, {"mgcc-abi", no_argument, NULL, OPTION_USES_GCC_ABI}, {"mrx-abi", no_argument, NULL, OPTION_USES_RX_ABI}, + {"mcpu",required_argument,NULL,OPTION_CPU}, {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); @@ -155,6 +158,22 @@ md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED) case OPTION_USES_RX_ABI: elf_flags |= E_FLAG_RX_ABI; return 1; + + case OPTION_CPU: + if (strcasecmp (arg, "rx100") == 0) + rx_cpu = RX100; + else if (strcasecmp (arg, "rx200") == 0) + rx_cpu = RX200; + else if (strcasecmp (arg, "rx600") == 0) + rx_cpu = RX600; + else if (strcasecmp (arg, "rx610") == 0) + rx_cpu = RX610; + else + { + as_warn (_("unrecognised RX CPU type %s"), arg); + break; + } + return 1; } return 0; } @@ -173,6 +192,7 @@ md_show_usage (FILE * stream) fprintf (stream, _(" --mrelax\n")); fprintf (stream, _(" --mpid\n")); fprintf (stream, _(" --mint-register=\n")); + fprintf (stream, _(" --mcpu=\n")); } static void diff --git a/gas/doc/c-rx.texi b/gas/doc/c-rx.texi index d6390c8bd1..2b3ab3964b 100644 --- a/gas/doc/c-rx.texi +++ b/gas/doc/c-rx.texi @@ -1,5 +1,4 @@ -@c Copyright 2008, 2009, 2011 -@c Free Software Foundation, Inc. +@c Copyright 2008-2013 Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @ifset GENERIC @@ -106,6 +105,13 @@ by the assembled code. With this version of the ABI function arguments that are passed on the stack are aligned to their natural alignments. This option is the default. +@cindex @samp{-mcpu=} +@item -mcpu=@var{name} +This option tells the assembler the target CPU type. Currently the +@code{rx200}, @code{rx600} and @code{rx610} are recognised as valid +cpu names. Attempting to assemble an instruction not supported by the +indicated cpu type will result in an error message being generated. + @end table @node RX-Modifiers -- cgit v1.2.1