public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Advice needed how to avoid generation of extra sign_extends in .md file
@ 2002-10-03 18:07 Igor Shevlyakov
  2002-10-03 19:14 ` Richard Henderson
  2002-10-04  9:51 ` Jim Wilson
  0 siblings, 2 replies; 3+ messages in thread
From: Igor Shevlyakov @ 2002-10-03 18:07 UTC (permalink / raw)
  To: gcc, gcc-help

Hi everybody,

I wonder if somebody know how to make back-end generate better code
under following conditions:

- 32 bit opearations always sign extend their result into whole 64-bit
result registers.
- conditional branches work only on 64-bit registers
- loads are always sign-extending.

now if we have

int64 a, b;
int32 c, d, f;

c = d + f;
a = b + c;


How to avoid sign_extend before second plus since result of 'addsi3' was
already extended?

Even worse:

int16 *pi, j;
int64 a,b;


j = *pi + 3;
a = b + j;

Doesn't really requires any extensions since *pi already sign extended
target register and we could use same instruction to add 16-bits as for
add 32-bits and result will be 64-bit sign extended in that case.
But I couldn't come up with idea how to teach .md file all that.

Thanks a lot
Igor

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

* Re: Advice needed how to avoid generation of extra sign_extends in .md file
  2002-10-03 18:07 Advice needed how to avoid generation of extra sign_extends in .md file Igor Shevlyakov
@ 2002-10-03 19:14 ` Richard Henderson
  2002-10-04  9:51 ` Jim Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2002-10-03 19:14 UTC (permalink / raw)
  To: Igor Shevlyakov; +Cc: gcc, gcc-help

On Thu, Oct 03, 2002 at 06:09:21PM -0700, Igor Shevlyakov wrote:
> - 32 bit opearations always sign extend their result into whole 64-bit
> result registers.
> - conditional branches work only on 64-bit registers
> - loads are always sign-extending.

See the alpha port, which has these same characteristics.


r~

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

* Re: Advice needed how to avoid generation of extra sign_extends in .md file
  2002-10-03 18:07 Advice needed how to avoid generation of extra sign_extends in .md file Igor Shevlyakov
  2002-10-03 19:14 ` Richard Henderson
@ 2002-10-04  9:51 ` Jim Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2002-10-04  9:51 UTC (permalink / raw)
  To: Igor Shevlyakov; +Cc: gcc, gcc-help

See also the MIPS port which also has the same problem, and which uses a
different solution than the alpha port.  I don't know offhand which solution
is better.

Jim

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

end of thread, other threads:[~2002-10-04 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-03 18:07 Advice needed how to avoid generation of extra sign_extends in .md file Igor Shevlyakov
2002-10-03 19:14 ` Richard Henderson
2002-10-04  9:51 ` Jim Wilson

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