public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3374] MIPS: add .module arch and ase to all output asm
@ 2021-09-07  0:47 YunQiang Su
  0 siblings, 0 replies; only message in thread
From: YunQiang Su @ 2021-09-07  0:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:58572bbb62c9588c658fd7656ee359d27c306fb2

commit r12-3374-g58572bbb62c9588c658fd7656ee359d27c306fb2
Author: YunQiang Su <yunqiang.su@cipunited.com>
Date:   Fri Sep 3 03:32:26 2021 -0400

    MIPS: add .module arch and ase to all output asm
    
    Currently, the asm output file for MIPS has no rev info.
    It can make some trouble, for example:
    
      assembler is mips1 by default,
      gcc is fpxx by default.
    
    To assemble the output of gcc -S, we have to pass -mips2
    to assembler.
    
    The same situation is for some CPU has extension insn.
    Octeon is an example.
    So we can just add ".set arch=octeon".
    
    If an ASE is enabled, .module ase will also be used.
    
    gcc/ChangeLog:
            * config/mips/mips.c (mips_file_start): add .module for
              arch and ase.

Diff:
---
 gcc/config/mips/mips.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 493d3de487b..ade5d7041f0 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -9896,6 +9896,43 @@ mips_file_start (void)
   else
     fputs ("\t.module\tnooddspreg\n", asm_out_file);
 
+  fprintf (asm_out_file, "\t.module\tarch=%s\n", mips_arch_info->name);
+  /* FIXME: DSPR3 is not supported by GCC? gas does support it */
+  if (TARGET_DSPR2)
+    fputs ("\t.module\tdspr2\n", asm_out_file);
+  else if (TARGET_DSP)
+    fputs ("\t.module\tdsp\n", asm_out_file);
+  if (TARGET_EVA)
+    fputs ("\t.module\teva\n", asm_out_file);
+  if (TARGET_MCU)
+    fputs ("\t.module\tmcu\n", asm_out_file);
+  if (TARGET_MDMX)
+    fputs ("\t.module\tmdmx\n", asm_out_file);
+  if (TARGET_MIPS3D)
+    fputs ("\t.module\tmips3d\n", asm_out_file);
+  if (TARGET_MT)
+    fputs ("\t.module\tmt\n", asm_out_file);
+  if (TARGET_SMARTMIPS)
+    fputs ("\t.module\tsmartmips\n", asm_out_file);
+  if (TARGET_VIRT)
+    fputs ("\t.module\tvirt\n", asm_out_file);
+  if (TARGET_MSA)
+    fputs ("\t.module\tmsa\n", asm_out_file);
+  if (TARGET_XPA)
+    fputs ("\t.module\txpa\n", asm_out_file);
+  /* FIXME: MIPS16E2 is not supported by GCC? gas does support it */
+  if (TARGET_CRC)
+    fputs ("\t.module\tcrc\n", asm_out_file);
+  if (TARGET_GINV)
+    fputs ("\t.module\tginv\n", asm_out_file);
+  if (TARGET_LOONGSON_MMI)
+    fputs ("\t.module\tloongson-mmi\n", asm_out_file);
+  /* FIXME: LOONGSON-CAM is not supported by GCC? gas does support it */
+  if (TARGET_LOONGSON_EXT2)
+    fputs ("\t.module\tloongson-ext2\n", asm_out_file);
+  else if (TARGET_LOONGSON_EXT)
+    fputs ("\t.module\tloongson-ext\n", asm_out_file);
+
 #else
 #ifdef HAVE_AS_GNU_ATTRIBUTE
   {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-07  0:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  0:47 [gcc r12-3374] MIPS: add .module arch and ase to all output asm YunQiang Su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).