public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Richard Henderson <rth@redhat.com>
Cc: Markus L <markusl.se78@gmail.com>, gcc@gcc.gnu.org
Subject: Re: Storing 16bit values in upper part of 32bit registers
Date: Fri, 06 Nov 2009 02:09:00 -0000	[thread overview]
Message-ID: <4AF38565.8040103@zytor.com> (raw)
In-Reply-To: <4AD7462F.4070805@redhat.com>

On 10/15/2009 08:56 AM, Richard Henderson wrote:
> On 10/15/2009 07:41 AM, Markus L wrote:
>> However the IS is designed so that it is beneficial to to store 16bit
>> values in the high part of the registers (rNh) and also the calling
>> conventions that we want follow require 16bit values to be passed and
>> returned in rNh.
>>
>> What would be the "proper way" make the compiler use the upper parts
>> of these registers for the 16bit operands?
> 
> This feature is going to be difficult, but not impossible, and unless 
> your ISA has some really odd features I won't vouch for the code quality.
> 
> You say you want to canonically represent HImode in the high-part of the 
> register.  Additionally, you'll have to represent QImode in the 
> high-part (if not further in the high byte).
> 
> You'll need to follow the mips port and define TRULY_NOOP_TRUNCATION and 
> the associated truncMN2 patterns.
> 
> If you do all this, you won't have to do anything with FUNCTION_VALUE 
> etc at all.
> 

Sorry for a *way* *late* reply to this, but wouldn't it also work to
model the register file as a set of 16-bit registers (since that's what
you really have -- individually addressable 16-bit registers) and
exclude SImode values from register pairs which are not aligned.  Then
one can simply prefer the high 16-bit registers to the low 16-bit
registers in the register priority sequence.

I'm assuming there is something wrong with this, but I'm kind of curious
as to what it would be.

	-hpa

  reply	other threads:[~2009-11-06  2:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 15:33 Markus L
2009-10-15 15:43 ` sumanth
2009-10-15 16:25 ` Richard Henderson
2009-11-06  2:09   ` H. Peter Anvin [this message]
2009-11-06 14:29     ` Markus L

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=4AF38565.8040103@zytor.com \
    --to=hpa@zytor.com \
    --cc=gcc@gcc.gnu.org \
    --cc=markusl.se78@gmail.com \
    --cc=rth@redhat.com \
    /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).