public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Feature request: ability to describe x86 register halves as contraints.
@ 1998-07-01 13:20 Michael Meissner
  1998-07-01 20:15 ` Joern Rennecke
  0 siblings, 1 reply; 26+ messages in thread
From: Michael Meissner @ 1998-07-01 13:20 UTC (permalink / raw)
  To: amylaar, law; +Cc: ak, egcs

| I think we should change SUBREG to count addressable units instead of
| 'words'.  This would also fix some brokenness when there are
| varying register sizes (E.g. floating point wider than integer...)

I would not stop at addressable units, but go for bits.  Either that, or change
things to use {SIGN,ZERO}_EXTRACT, along with some sort of WIDER/CHANGE_TYPE
support.  It might be useful to use a different name than SUBREG, so that you
can identify the broken code.

^ permalink raw reply	[flat|nested] 26+ messages in thread
[parent not found: <359ABD84.2FC4@tssc.co.nz>]
* Feature request: ability to describe x86 register halves as contraints.
@ 1998-06-29 20:41 ak
  1998-06-30  0:42 ` Richard Henderson
  1998-06-30  1:02 ` Jeffrey A Law
  0 siblings, 2 replies; 26+ messages in thread
From: ak @ 1998-06-29 20:41 UTC (permalink / raw)
  To: egcs

Hallo, 

Egcs does not handle x86 register halves (al/ah etc.) well. Although
it is able to turn (x & 0xFF) into an access to the rL register, there
is no way to trick it into generating write access to rH registers
(neither union { char h,l; short val } x; x.h = 1; nor and/shift/or tricks
work). 

It is often good for the code to use the register halves, because in 
algorithms which operate on 8 values (e.g. some ciphers) the ability
to access register halves effectively adds 4 more 8bit registers.
Because the x86 CPUs are so register starved this can speed some inner
loops up considerably.

I understand that making gcc do this automatically is a non-trivial
amount of work. 

To optimize a critical inner loop I've resorted to use inline assembly
in some critical computations to work directly on the 8bit halves. 
Unfortunately I've hit a limitation of the gcc constraints language
now. There is no way to describe:

"Give me a 16bit register, but insert the high/low byte form of the register-
name here." 

e.g.  it should pass in a 16bit value in a register like AX, but insert
into the assembler template AH or AL depending on a special flag. 

The only way to do this is to use fixed input registers and hardcode the 
register halves. Unfortunately this adds some compiler version dependencies
to my code, and also limits the possibilities of the compiler to do other
optimizations. 

Is it possible to add such an extension to the constraints language? 
Hopefully only minimal changes should be needed for this. 

-Andi


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

end of thread, other threads:[~1998-07-03  0:12 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-01 13:20 Feature request: ability to describe x86 register halves as contraints Michael Meissner
1998-07-01 20:15 ` Joern Rennecke
     [not found] <359ABD84.2FC4@tssc.co.nz>
1998-07-02  1:39 ` Jeffrey A Law
1998-07-02  1:39   ` Bill Currie
1998-07-02  1:39     ` Jeffrey A Law
1998-07-03  0:12       ` Bill Currie
1998-07-02 11:02     ` Joern Rennecke
1998-07-02 15:15       ` Bill Currie
1998-07-02 15:15         ` Joern Rennecke
  -- strict thread matches above, loose matches on Subject: below --
1998-06-29 20:41 ak
1998-06-30  0:42 ` Richard Henderson
1998-06-30  4:50   ` ak
1998-06-30 19:49     ` Alan Modra
1998-06-30 19:49       ` Andreas Kleen
1998-06-30 14:08   ` Jeffrey A Law
1998-06-30  9:24     ` Richard Henderson
1998-06-30  1:02 ` Jeffrey A Law
1998-06-30 11:53   ` Joern Rennecke
1998-06-30 11:53     ` Jeffrey A Law
1998-07-01  3:42       ` Richard Henderson
1998-06-30 15:15   ` Bill Currie
1998-06-30 15:26     ` Jeffrey A Law
1998-06-30 23:15       ` Bill Currie
1998-06-30 19:49         ` Jeffrey A Law
1998-07-01 10:51           ` Joern Rennecke
1998-07-01 10:51             ` Jeffrey A Law

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