public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mmitchell@usa.net>
To: hjl@lucon.org
Cc: egcs@cygnus.com
Subject: Re: An x86 patch for egcs
Date: Fri, 13 Mar 1998 18:47:00 -0000	[thread overview]
Message-ID: <199803132033.MAA01356@> (raw) <smtp.earthlink.net> (raw)
In-Reply-To: <m0yDILN-00058JC@ocean.lucon.org>

    Hi,

    This is a partial patch for the PPro bug I reported. It fixed
    loading standard x87 constants in conditional move. But it still
    leaves an undefined label in one of my test cases. My other test
    case still doesn't compile.

    Thanks.


This is not a commentary on the contents of this patch, merely its
form.  I object strongly to the kind of code-duplication in your
patch.  It appears to me that you replaced each of several similar
pieces of code with some large block of code which is also similar.  I
hope that you did this only because you weren't quite finished with
the patch, and wanted someone to help resolve the remaining problems.

This kind of code duplication is a pet peeve of mine; it makes it much
harder to maintain software, especially software as complex as gcc.
In general, if you had to change something in several places, then
there should have been some kind of abstraction (e.g. a macro or a
function) that would have allowed you to change something in only one
place.  That might be the fault of the previous author, but it's up to
us, the current authors, to correct these defects.

I hereby encourage the maintainers to reject patches that contain
unnecessary duplication, including mine.

    -- 
    H.J. Lu (hjl@gnu.org)
    --
    Thu Mar 12 08:25:19 1998  H.J. Lu  (hjl@gnu.org)

	    * config/i386/i386.md (movsfcc_1, movdfcc_1, movxfcc_1): Handle
	    loading standard x87 constants.

    Index: config/i386/i386.md
    ===================================================================
    RCS file: /home/work/cvs/gnu/egcs/gcc/config/i386/i386.md,v
    retrieving revision 1.1.1.8
    diff -u -r1.1.1.8 i386.md
    --- i386.md	1998/03/12 17:19:11	1.1.1.8
    +++ i386.md	1998/03/13 00:12:40
    @@ -7528,8 +7529,21 @@
	    output_asm_insn (AS1 (fld%z2,%y2), operands);
	   else
	     {
    -	  operands[2] = XEXP (operands[2], 0);
    -	  output_asm_insn (AS1 (fld%z2,%y2), operands);
    +	  int conval = standard_80387_constant_p (operands[2]);
    +
    +	  switch (conval)
    +	    {
    +	    case 1:
    +	      fprintf (asm_out_file, \"\\tfldz\\n\");
    +	      break;
    +	    case 2:
    +	      fprintf (asm_out_file, \"\\tfld1\\n\");
    +	      break;
    +	    default:
    +	      operands[2] = XEXP (operands[2], 0);
    +	      output_asm_insn (AS1 (fld%z2,%y2), operands);
    +	      break;
    +	    }
	     }
	   output_asm_insn (\"jmp %l1\", xops);
	   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (xops[0]));
    @@ -7537,8 +7551,21 @@
	      output_asm_insn (AS1 (fld%z3,%y3), operands);
	   else
	    {
    -	  operands[3] = XEXP (operands[3], 0);
    -	  output_asm_insn (AS1 (fld%z3,%y3), operands);
    +	  int conval = standard_80387_constant_p (operands[3]);
    +
    +	  switch (conval)
    +	    {
    +	    case 1:
    +	      fprintf (asm_out_file, \"\\tfldz\\n\");
    +	      break;
    +	    case 2:
    +	      fprintf (asm_out_file, \"\\tfld1\\n\");
    +	      break;
    +	    default:
    +	      operands[3] = XEXP (operands[3], 0);
    +	      output_asm_insn (AS1 (fld%z3,%y3), operands);
    +	      break;
    +	   }

<more deleted>

-- 
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available

       reply	other threads:[~1998-03-13 18:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-13 18:47 Mark Mitchell [this message]
     [not found] ` <smtp.earthlink.net>
1998-03-13 18:29   ` H.J. Lu
1998-03-18 16:14   ` PATCH: add semantics.c Mark Mitchell
1998-03-19 21:47   ` PATCH for Re: cp/semantics.c is broken Mark Mitchell
1998-03-23 15:35   ` PATCH for Re: egcs-1.0.2, egcs-980315 and templates Andrew Pollard
1998-03-23 19:24   ` Mark Mitchell
  -- strict thread matches above, loose matches on Subject: below --
1998-03-19 12:55 cp/semantics.c is broken H.J. Lu
1998-03-19 12:55 egcs-1.0.2, egcs-980315 and templates Andrew Pollard
1998-03-12 17:24 An x86 patch for egcs H.J. Lu
1998-03-16 19:46 ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199803132033.MAA01356@ \
    --to=mmitchell@usa.net \
    --cc=egcs@cygnus.com \
    --cc=hjl@lucon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).