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".
---
 gcc/config/mips/mips.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 493d3de48..743a1d0fe 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -9896,6 +9896,12 @@ mips_file_start (void)
   else
     fputs ("\t.module\tnooddspreg\n", asm_out_file);
 
+  if (!global_options_set.x_mips_arch_option
+      || startswith(mips_arch_info->name, "mips"))
+    fprintf (asm_out_file, "\t.module\t%s\n", mips_arch_info->name);
+  else
+    fprintf (asm_out_file, "\t.set\tarch=%s\n", mips_arch_info->name);
+
 #else
 #ifdef HAVE_AS_GNU_ATTRIBUTE
   {
-- 
2.30.2

Reply via email to