public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v3] MIPS: add .module mipsREV/.set arch= to all output asm file
@ 2021-09-03  1:35 YunQiang Su
  2021-09-03  1:48 ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: YunQiang Su @ 2021-09-03  1:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: syq, xry111, jeffreyalaw, YunQiang Su

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-03  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  1:35 [PATCH v3] MIPS: add .module mipsREV/.set arch= to all output asm file YunQiang Su
2021-09-03  1:48 ` Maciej W. Rozycki
2021-09-03  1:53   ` YunQiang Su
2021-09-03  2:03     ` 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).