public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Jump optimisation patches
       [not found] <199711050316.QAA19266@ongaonga.chch.cri.nz>
@ 1998-02-02  1:09 ` Jeffrey A Law
  1998-02-02 11:43   ` Michael P. Hayes
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey A Law @ 1998-02-02  1:09 UTC (permalink / raw)
  To: Michael P. Hayes; +Cc: gcc2, egcs

  In message <199711050316.QAA19266@ongaonga.chch.cri.nz>you write:
  > 
  > 1997-11-05  Michael P. Hayes  <michaelh@ongaonga.chch.cri.nz>
  > 
  > 	(jump.c): Allow conditional loading of floating point constants
  > 	and constants from memory.  Reinstalled modified_in_p tests.
I've installed these patches into egcs.

Don't you also need one in the conditional for this optimization:

         /* If branches are expensive, convert
                if (foo) bar++;    to    bar += (foo != 0);
             and similarly for "bar--;"

             INSN is the conditional branch around the arithmetic.  We set:

             TEMP is the arithmetic insn.
             TEMP1 is the SET doing the arithmetic.
             TEMP2 is the operand being incremented or decremented.
             TEMP3 to the condition being tested.
             TEMP4 to the earliest insn used to find the condition.  */


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

* Re: Jump optimisation patches
  1998-02-02 11:43   ` Michael P. Hayes
@ 1998-02-02 10:32     ` Jeffrey A Law
  1998-02-02 15:13       ` Michael P. Hayes
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey A Law @ 1998-02-02 10:32 UTC (permalink / raw)
  To: Michael P. Hayes; +Cc: gcc2, egcs

  In message < 199802020948.WAA09821@ongaonga.chch.cri.nz >you write:
  > Jeffrey A Law writes:
  >  > 
  >  >   In message <199711050316.QAA19266@ongaonga.chch.cri.nz>you write:
  >  >   > 
  >  >   > 1997-11-05  Michael P. Hayes  <michaelh@ongaonga.chch.cri.nz>
  >  >   > 
  >  >   > 	(jump.c): Allow conditional loading of floating point constants
  >  >   > 	and constants from memory.  Reinstalled modified_in_p tests.
  >  > I've installed these patches into egcs.
  > 
  > Whoa.  I completely rewrote these patches for GCC 2.8.0 to test for
  > the proper place that the extra move insn should be inserted.  I've
  > been using the patch for the conditional loading of floating point
  > constants without any problems but Kenner didn't include it since
  > he had some reservations about its utility.
jump.c in egcs is very close to jump.c in gcc-2.8; we haven't made
any significant changes to it yet.  As a result it was quite easy
to make your patch work for egcs :-)

  > The conditional loading of memory operands could also be more general.
  > 
  >  > Don't you also need one in the conditional for this optimization:
  >  > 
  >  >          /* If branches are expensive, convert
  >  >                 if (foo) bar++;    to    bar += (foo != 0);
  >  >              and similarly for "bar--;"
  > 
  > Ah, need one what?  
A call to modified_in_p.

jeff

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

* Re: Jump optimisation patches
  1998-02-02  1:09 ` Jump optimisation patches Jeffrey A Law
@ 1998-02-02 11:43   ` Michael P. Hayes
  1998-02-02 10:32     ` Jeffrey A Law
  0 siblings, 1 reply; 4+ messages in thread
From: Michael P. Hayes @ 1998-02-02 11:43 UTC (permalink / raw)
  To: law; +Cc: Michael P. Hayes, gcc2, egcs

Jeffrey A Law writes:
 > 
 >   In message <199711050316.QAA19266@ongaonga.chch.cri.nz>you write:
 >   > 
 >   > 1997-11-05  Michael P. Hayes  <michaelh@ongaonga.chch.cri.nz>
 >   > 
 >   > 	(jump.c): Allow conditional loading of floating point constants
 >   > 	and constants from memory.  Reinstalled modified_in_p tests.
 > I've installed these patches into egcs.

Whoa.  I completely rewrote these patches for GCC 2.8.0 to test for
the proper place that the extra move insn should be inserted.  I've
been using the patch for the conditional loading of floating point
constants without any problems but Kenner didn't include it since
he had some reservations about its utility.

The conditional loading of memory operands could also be more general.

 > Don't you also need one in the conditional for this optimization:
 > 
 >          /* If branches are expensive, convert
 >                 if (foo) bar++;    to    bar += (foo != 0);
 >              and similarly for "bar--;"

Ah, need one what?  

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

* Re: Jump optimisation patches
  1998-02-02 10:32     ` Jeffrey A Law
@ 1998-02-02 15:13       ` Michael P. Hayes
  0 siblings, 0 replies; 4+ messages in thread
From: Michael P. Hayes @ 1998-02-02 15:13 UTC (permalink / raw)
  To: law; +Cc: Michael P. Hayes, gcc2, egcs

Jeffrey A Law writes:
 > Don't you also need one in the conditional for this optimization:
 > 
 >          /* If branches are expensive, convert
 >                 if (foo) bar++;    to    bar += (foo != 0);
 >              and similarly for "bar--;"
 > 

I don't think so.  It appears that this optimisation is caught
by the more general test (circa line 1000 in jump.c) for targets
that don't have CC0.  The patches I submitted were to fix a problem
for those targets where an insn was moved into a place where
it clobbered something required by the following insn (usually
the contents of the CC register).

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

end of thread, other threads:[~1998-02-02 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199711050316.QAA19266@ongaonga.chch.cri.nz>
1998-02-02  1:09 ` Jump optimisation patches Jeffrey A Law
1998-02-02 11:43   ` Michael P. Hayes
1998-02-02 10:32     ` Jeffrey A Law
1998-02-02 15:13       ` Michael P. Hayes

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