public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Alternative number in output_asm_name
@ 2008-05-21  9:39 Ye, Joey
  2008-05-23 18:35 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Ye, Joey @ 2008-05-21  9:39 UTC (permalink / raw)
  To: gcc-patches

It is well known which_alternative is from 0 to N-1. Where as in .s file
generated with option -dp, alternative number is from 1 to N. This is
very confusing. 

For example, i386.md has
(define_insn "*movsf_1"
...
switch (which_alternative)
...
case 7: case 8:
      return "movss\t{%1, %0|%0, %1}";

But the output .s is:
movss   %xmm0, (%rax)   # 10    *movsf_1/9      [length = 4]
                                                               ^^^
Confusing

I'd suggest to follow C convention to output 0 to N-1 in .s file. OK to
mainline?

Thanks - Joey

2008-05-21 Joey Ye <joey.ye@intel.com>

	* final.c (output_asm_name): Don't plus one to
which_alternative.

Index: gcc/final.c
===================================================================
--- gcc/final.c	(revision 134775)
+++ gcc/final.c	(working copy)
@@ -3000,7 +3000,7 @@ output_asm_name (void)
 	       ASM_COMMENT_START, INSN_UID (debug_insn),
 	       insn_data[num].name);
       if (insn_data[num].n_alternatives > 1)
-	fprintf (asm_out_file, "/%d", which_alternative + 1);
+	fprintf (asm_out_file, "/%d", which_alternative);
 #ifdef HAVE_ATTR_length
       fprintf (asm_out_file, "\t[length = %d]",
 	       get_attr_length (debug_insn));

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

* Re: [PATCH] Alternative number in output_asm_name
  2008-05-21  9:39 [PATCH] Alternative number in output_asm_name Ye, Joey
@ 2008-05-23 18:35 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2008-05-23 18:35 UTC (permalink / raw)
  To: Ye, Joey; +Cc: gcc-patches

On Wed, May 21, 2008 at 2:06 AM, Ye, Joey <joey.ye@intel.com> wrote:
> It is well known which_alternative is from 0 to N-1. Where as in .s file
> generated with option -dp, alternative number is from 1 to N. This is
> very confusing.
>
> For example, i386.md has
> (define_insn "*movsf_1"
> ...
> switch (which_alternative)
> ...
> case 7: case 8:
>      return "movss\t{%1, %0|%0, %1}";
>
> But the output .s is:
> movss   %xmm0, (%rax)   # 10    *movsf_1/9      [length = 4]
>                                                               ^^^
> Confusing
>
> I'd suggest to follow C convention to output 0 to N-1 in .s file. OK to
> mainline?
>
> Thanks - Joey
>
> 2008-05-21 Joey Ye <joey.ye@intel.com>
>
>        * final.c (output_asm_name): Don't plus one to
> which_alternative.
>

It also bothers me when I am comparing the alternative indicated
in the assembly code with alternatives in md files. I think it is a
good idea to make 2 consistent. Are they any objections to this
simple and useful change?

Thanks.


H.J.

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

end of thread, other threads:[~2008-05-23 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-21  9:39 [PATCH] Alternative number in output_asm_name Ye, Joey
2008-05-23 18:35 ` H.J. Lu

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