From bdc6c06e3b08ec48ec5ee2174dedc846969c36fd Mon Sep 17 00:00:00 2001 From: Chenghua Xu Date: Wed, 29 Aug 2018 19:57:39 +0800 Subject: [MIPS/GAS] Split Loongson EXT Instructions from loongson3a. bfd/ * elfxx-mips.c (infer_mips_abiflags): Use ases instead of isa_ext for infer ABI flags. (print_mips_ases): Add Loongson EXT extension. binutils/ * readelf.c (print_mips_ases): Add Loongson EXT extension. elfcpp/ * mips.h (AFL_ASE_LOONGSON_EXT): New enum. gas/ * NEWS: Mention Loongson EXTensions (EXT) support. * config/tc-mips.c (options): Add OPTION_LOONGSON_EXT and OPTION_NO_LOONGSON_EXT. (md_longopts): Likewise. (mips_ases): Define availability for EXT. (mips_convert_ase_flags): Map ASE_LOONGSON_EXT to AFL_ASE_LOONGSON_EXT. (mips_cpu_info_table): Add ASE_LOONGSON_EXT for loongson3a. (md_show_usage): Add help for -mloongson-ext and -mno-loongson-ext. * doc/as.texi: Document -mloongson-ext, -mno-loongson-ext. * doc/c-mips.texi: Document -mloongson-ext, -mno-loongson-ext, .set loongson-ext and .set noloongson-ext. * testsuite/gas/mips/loongson-mmi.d: Add ASE flag. include/ * elf/mips.h (AFL_ASE_LOONGSON_EXT): New macro. (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_EXT. * opcode/mips.h (ASE_LOONGSON_EXT): New macro. opcodes/ * mips-dis.c (mips_arch_choices): Add EXT to loongson3a descriptors. (parse_mips_ase_option): Handle -M loongson-ext option. (print_mips_disassembler_options): Document -M loongson-ext. * mips-opc.c (IL3A): Delete. * mips-opc.c (LEXT): New macro. (mips_opcodes): Replace IL2F|IL3A marking with LEXT for EXT instructions. --- gas/ChangeLog | 17 +++++++++++++++++ gas/NEWS | 2 ++ gas/config/tc-mips.c | 18 ++++++++++++++++-- gas/doc/as.texi | 7 +++++++ gas/doc/c-mips.texi | 15 +++++++++++++++ gas/testsuite/gas/mips/loongson-3a-mmi.d | 1 + 6 files changed, 58 insertions(+), 2 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index 30b82ae..94fd28c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,22 @@ 2018-08-29 Chenghua Xu + * NEWS: Mention Loongson EXTensions (EXT) support. + * config/tc-mips.c (options): Add OPTION_LOONGSON_EXT and + OPTION_NO_LOONGSON_EXT. + (md_longopts): Likewise. + (mips_ases): Define availability for EXT. + (mips_convert_ase_flags): Map ASE_LOONGSON_EXT to + AFL_ASE_LOONGSON_EXT. + (mips_cpu_info_table): Add ASE_LOONGSON_EXT for loongson3a. + (md_show_usage): Add help for -mloongson-ext and + -mno-loongson-ext. + * doc/as.texi: Document -mloongson-ext, -mno-loongson-ext. + * doc/c-mips.texi: Document -mloongson-ext, -mno-loongson-ext, + .set loongson-ext and .set noloongson-ext. + * testsuite/gas/mips/loongson-mmi.d: Add ASE flag. + +2018-08-29 Chenghua Xu + * NEWS: Mention Loongson Content Address Memory (CAM) support. * config/tc-mips.c (options): Add OPTION_LOONGSON_CAM and diff --git a/gas/NEWS b/gas/NEWS index b710c7a..48854e5 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,5 +1,7 @@ -*- text -*- +* Add support for the MIPS Loongson EXTensions (EXT) instructions. + * Add support for the MIPS Loongson Content Address Memory (CAM) ASE. * Add support for the C-SKY processor series. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 1f58a6d..51eee00 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1533,6 +1533,8 @@ enum options OPTION_NO_LOONGSON_MMI, OPTION_LOONGSON_CAM, OPTION_NO_LOONGSON_CAM, + OPTION_LOONGSON_EXT, + OPTION_NO_LOONGSON_EXT, OPTION_END_OF_ENUM }; @@ -1597,6 +1599,8 @@ struct option md_longopts[] = {"mno-loongson-mmi", no_argument, NULL, OPTION_NO_LOONGSON_MMI}, {"mloongson-cam", no_argument, NULL, OPTION_LOONGSON_CAM}, {"mno-loongson-cam", no_argument, NULL, OPTION_NO_LOONGSON_CAM}, + {"mloongson-ext", no_argument, NULL, OPTION_LOONGSON_EXT}, + {"mno-loongson-ext", no_argument, NULL, OPTION_NO_LOONGSON_EXT}, /* Old-style architecture options. Don't add more of these. */ {"m4650", no_argument, NULL, OPTION_M4650}, @@ -1804,6 +1808,11 @@ static const struct mips_ase mips_ases[] = { OPTION_LOONGSON_CAM, OPTION_NO_LOONGSON_CAM, 0, 0, -1, -1, -1 }, + + { "loongson-ext", ASE_LOONGSON_EXT, 0, + OPTION_LOONGSON_EXT, OPTION_NO_LOONGSON_EXT, + 0, 0, -1, -1, + -1 }, }; /* The set of ASEs that require -mfp64. */ @@ -19039,6 +19048,8 @@ mips_convert_ase_flags (int ase) ext_ases |= AFL_ASE_LOONGSON_MMI; if (ase & ASE_LOONGSON_CAM) ext_ases |= AFL_ASE_LOONGSON_CAM; + if (ase & ASE_LOONGSON_EXT) + ext_ases |= AFL_ASE_LOONGSON_EXT; return ext_ases; } @@ -19786,8 +19797,8 @@ static const struct mips_cpu_info mips_cpu_info_table[] = /* MIPS 64 Release 2 */ /* Loongson CPU core */ - { "loongson3a", 0, ASE_LOONGSON_MMI | ASE_LOONGSON_CAM, ISA_MIPS64R2, - CPU_LOONGSON_3A }, + { "loongson3a", 0, ASE_LOONGSON_MMI | ASE_LOONGSON_CAM | ASE_LOONGSON_EXT, + ISA_MIPS64R2, CPU_LOONGSON_3A }, /* Cavium Networks Octeon CPU core */ { "octeon", 0, 0, ISA_MIPS64R2, CPU_OCTEON }, @@ -20066,6 +20077,9 @@ MIPS options:\n\ -mloongson-cam generate Loongson Content Address Memory (CAM) instructions\n\ -mno-loongson-cam do not generate Loongson Content Address Memory Instructions\n")); fprintf (stream, _("\ +-mloongson-ext generate Loongson EXTensions (EXT) instructions\n\ +-mno-loongson-ext do not generate Loongson EXTensions Instructions\n")); + fprintf (stream, _("\ -minsn32 only generate 32-bit microMIPS instructions\n\ -mno-insn32 generate all microMIPS instructions\n")); fprintf (stream, _("\ diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 5d10e07..92dd366 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -446,6 +446,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-mginv}] [@b{-mno-ginv}] [@b{-mloongson-mmi}] [@b{-mno-loongson-mmi}] [@b{-mloongson-cam}] [@b{-mno-loongson-cam}] + [@b{-mloongson-ext}] [@b{-mno-loongson-ext}] [@b{-minsn32}] [@b{-mno-insn32}] [@b{-mfix7000}] [@b{-mno-fix7000}] [@b{-mfix-rm7000}] [@b{-mno-fix-rm7000}] @@ -1580,6 +1581,12 @@ Generate code for the Loongson Content Address Memory (CAM) instructions. This tells the assembler to accept Loongson CAM instructions. @samp{-mno-loongson-cam} turns off this option. +@item -mloongson-ext +@itemx -mno-loongson-ext +Generate code for the Loongson EXTensions (EXT) instructions. +This tells the assembler to accept Loongson EXT instructions. +@samp{-mno-loongson-ext} turns off this option. + @item -minsn32 @itemx -mno-insn32 Only use 32-bit instruction encodings when generating code for the diff --git a/gas/doc/c-mips.texi b/gas/doc/c-mips.texi index 7d5d869..80b4160 100644 --- a/gas/doc/c-mips.texi +++ b/gas/doc/c-mips.texi @@ -260,6 +260,13 @@ Application Specific Extension. This tells the assembler to accept CAM instructions. @samp{-mno-loongson-cam} turns off this option. +@item -mloongson-ext +@itemx -mno-loongson-ext +Generate code for the Loongson EXTensions (EXT) instructions +Application Specific Extension. This tells the assembler to accept EXT +instructions. +@samp{-mno-loongson-ext} turns off this option. + @item -minsn32 @itemx -mno-insn32 Only use 32-bit instruction encodings when generating code for the @@ -1167,6 +1174,14 @@ instructions from the Loongson CAM from that point on in the assembly. The @code{.set noloongson-cam} directive prevents Loongson CAM instructions from being accepted. +@cindex Loongson EXTensions (EXT) instructions generation override +@kindex @code{.set loongson-ext} +@kindex @code{.set noloongson-ext} +The directive @code{.set loongson-ext} makes the assembler accept +instructions from the Loongson EXT from that point on in the assembly. +The @code{.set noloongson-ext} directive prevents Loongson EXT instructions +from being accepted. + Traditional MIPS assemblers do not support these directives. @node MIPS Floating-Point diff --git a/gas/testsuite/gas/mips/loongson-3a-mmi.d b/gas/testsuite/gas/mips/loongson-3a-mmi.d index 81503cb..8319a7d 100644 --- a/gas/testsuite/gas/mips/loongson-3a-mmi.d +++ b/gas/testsuite/gas/mips/loongson-3a-mmi.d @@ -16,6 +16,7 @@ ISA Extension: Loongson 3A ASEs: Loongson MMI ASE Loongson CAM ASE + Loongson EXT ASE FLAGS 1: .* FLAGS 2: .* -- cgit v1.1