From a117b0a51cd3c768453c244a3754c1b9a77e74fc Mon Sep 17 00:00:00 2001 From: Yoshinori Sato Date: Tue, 15 Dec 2015 09:26:56 +0000 Subject: Add support for RX V2 Instruction Set binutils * readelf.c(get_machine_flags): Add v2 flag. gas * config/rx-defs.h(rx_cpu_type): Add RXV2 type. * config/tc-rx.c(cpu_type_list): New type lookup table. (md_parse_option): Use lookup table for choose cpu. (md_show_usage): Add rxv2 for mcpu option. * doc/c-rx.texi: Likewise. * config/rx-parse.y: Add v2 instructions and ACC register. (rx_check_v2): check v2 type. include/elf * rx.h(E_FLAG_RX_V2): New RXv2 type. include/opcode * rx.h: Add new instructions. opcoes * rx-deocde.opc(rx_decode_opcode): Add new instructions pattern. * rx-dis.c(register_name): Add new register. gas/testsuite * gas/rx/emaca.d: New. * gas/rx/emaca.sm: New. * gas/rx/emsba.d: New. * gas/rx/emsba.sm: New. * gas/rx/emula.d: New. * gas/rx/emula.sm: New. * gas/rx/fadd.d: Add new pattern. * gas/rx/fadd.sm: Add new pattern. * gas/rx/fmul.d: Add new pattern. * gas/rx/fmul.sm: Add new pattern. * gas/rx/fsqrt.d: New. * gas/rx/fsqrt.sm: New. * gas/rx/fsub.d: Add new pattern. * gas/rx/fsub.sm: Add new pattern. * gas/rx/ftou.d: New. * gas/rx/ftou.sm: New. * gas/rx/maclh.d: New. * gas/rx/maclh.sm: New. * gas/rx/maclo.d: Add new pattern. * gas/rx/maclo.sm: Add new pattern. * gas/rx/macros.inc: Add new register. * gas/rx/movco.d: New. * gas/rx/movco.sm: New. * gas/rx/movli.d: New. * gas/rx/movli.sm: New. * gas/rx/msbhi.d: New. * gas/rx/msbhi.sm: New. * gas/rx/msblh.d: New. * gas/rx/msblh.sm: New. * gas/rx/msblo.d: New. * gas/rx/msblo.sm: New. * gas/rx/mullh.d: New. * gas/rx/mullh.sm: New. * gas/rx/mvfacgu.d: New. * gas/rx/mvfacgu.sm: New. * gas/rx/mvfachi.d: Add new pattern. * gas/rx/mvfachi.sm: Add new pattern. * gas/rx/mvfaclo.d: Add new pattern. * gas/rx/mvfaclo.sm: Add new pattern. * gas/rx/mvfacmi.d: Add new pattern. * gas/rx/mvfacmi.sm: Add new pattern. * gas/rx/mvfc.d: Add new pattern. * gas/rx/mvtacgu.d: New. * gas/rx/mvtacgu.sm: New. * gas/rx/mvtc.d: Add new pattern. * gas/rx/popc.d: Add new pattern. * gas/rx/pushc.d: Add new pattern. * gas/rx/racl.d: New. * gas/rx/racl.sm: New. * gas/rx/racw.d: Add new pattern. * gas/rx/racw.sm: Add new pattern. * gas/rx/rdacl.d: New. * gas/rx/rdacl.sm: New. * gas/rx/rdacw.d: New. * gas/rx/rdacw.sm: New. * gas/rx/rx.exp: Add option. * gas/rx/stnz.d: Add new pattern. * gas/rx/stnz.sm: Add new pattern. * gas/rx/stz.d: Add new pattern. * gas/rx/stz.sm: Add new pattern. * gas/rx/utof.d: New. * gas/rx/utof.sm: New. --- gas/config/tc-rx.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'gas/config/tc-rx.c') diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 82e94a7..e18e034 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -106,6 +106,21 @@ struct option md_longopts[] = }; size_t md_longopts_size = sizeof (md_longopts); +struct cpu_type +{ + char *cpu_name; + int type; +}; + +struct cpu_type cpu_type_list[] = +{ + {"rx100",RX100}, + {"rx200",RX200}, + {"rx600",RX600}, + {"rx610",RX610}, + {"rxv2",RXV2} +}; + int md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED) { @@ -161,25 +176,27 @@ md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED) 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; + { + unsigned int i; + for (i = 0; i < ARRAY_SIZE (cpu_type_list); i++) + { + if (strcasecmp (arg, cpu_type_list[i].cpu_name) == 0) + { + rx_cpu = cpu_type_list[i].type; + if (rx_cpu == RXV2) + elf_flags |= E_FLAG_RX_V2; + return 1; + } + } + as_warn (_("unrecognised RX CPU type %s"), arg); + break; + } case OPTION_DISALLOW_STRING_INSNS: elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO; return 1; } + return 0; } @@ -197,7 +214,7 @@ md_show_usage (FILE * stream) fprintf (stream, _(" --mrelax\n")); fprintf (stream, _(" --mpid\n")); fprintf (stream, _(" --mint-register=\n")); - fprintf (stream, _(" --mcpu=\n")); + fprintf (stream, _(" --mcpu=\n")); fprintf (stream, _(" --mno-allow-string-insns")); } -- cgit v1.1