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

* Re: [PATCH v3] MIPS: add .module mipsREV/.set arch= to all output asm file
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2021-09-03  1:48 UTC (permalink / raw)
  To: YunQiang Su; +Cc: gcc-patches

On Thu, 2 Sep 2021, YunQiang Su wrote:

> 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);

 Why not consistently `.module' for both legs?  And actually why not just 
`.module arch=...' in all cases?

  Maciej

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

* Re: [PATCH v3] MIPS: add .module mipsREV/.set arch= to all output asm file
  2021-09-03  1:48 ` Maciej W. Rozycki
@ 2021-09-03  1:53   ` YunQiang Su
  2021-09-03  2:03     ` YunQiang Su
  0 siblings, 1 reply; 4+ messages in thread
From: YunQiang Su @ 2021-09-03  1:53 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: YunQiang Su, apinski--- via Gcc-patches

Maciej W. Rozycki <macro@orcam.me.uk> 于2021年9月3日周五 上午9:48写道:
>
> On Thu, 2 Sep 2021, YunQiang Su wrote:
>
> > 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"))

here is a code style problem. I will fix it.

> > +    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);
>
>  Why not consistently `.module' for both legs?  And actually why not just
> `.module arch=...' in all cases?
>

Thanks for your advisor. I will have a try.
The reason is that I don't know this method.

>   Maciej

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

* Re: [PATCH v3] MIPS: add .module mipsREV/.set arch= to all output asm file
  2021-09-03  1:53   ` YunQiang Su
@ 2021-09-03  2:03     ` YunQiang Su
  0 siblings, 0 replies; 4+ messages in thread
From: YunQiang Su @ 2021-09-03  2:03 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: YunQiang Su, apinski--- via Gcc-patches

YunQiang Su <syq@debian.org> 于2021年9月3日周五 上午9:53写道:
>
> Maciej W. Rozycki <macro@orcam.me.uk> 于2021年9月3日周五 上午9:48写道:
> >
> > On Thu, 2 Sep 2021, YunQiang Su wrote:
> >
> > > 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"))
>
> here is a code style problem. I will fix it.
>
> > > +    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);
> >
> >  Why not consistently `.module' for both legs?  And actually why not just
> > `.module arch=...' in all cases?
> >
>
> Thanks for your advisor. I will have a try.

Ohh, it really works. woooo.
The testsuite is running.

> The reason is that I don't know this method.
>
> >   Maciej

^ 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).