public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ayonam Ray <ayonam@gmail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Complex half-word operations
Date: Tue, 18 Oct 2011 17:20:00 -0000	[thread overview]
Message-ID: <CA+V5N8=Uhhu1jNnyBqgV_VxrpXpFHV9Ze9UjTLF4-TvOWphLow@mail.gmail.com> (raw)
In-Reply-To: <CAKOQZ8w_q+bVQKec+ZNZBpFeP9jQqLAE8qkch6__JgTEzrzBAA@mail.gmail.com>

On 18 October 2011 22:38, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Oct 18, 2011 at 9:30 AM, Ayonam Ray <ayonam@gmail.com> wrote:
>> I'm trying to define a complex half word operation (add:CHI) using the
>> following RTL:
>>
>> (define_insn "addchi3"
>>   [(set (match_operand:CHI 0 "register_operand" "=r")
>>         (plus:CHI (match_operand:CHI 1 "register_operand" "r")
>>                   (match_operand:CHI 2 "register_operand" "r")))]
>>   ""
>>   "cmplxadd\t%1, %2, %0"
>>   [(set_attr "type" "complex")
>>    (set_attr "slot" "s1")
>>    (set_attr "predicable" "no")
>>    (set_attr "length" "4")])
>>
>> This architecture can perform arithmetic operations on "complex short"
>> data by packing the real and imaginary parts into two half words of a
>> 32-bit general register.
>>
>> However, the instruction matcher doesn't seem to generate this RTL at
>> all.  It splits the operation into two half word additions.  I have
>> handled the CHImode in the macros HARD_REGNO_NREGS, and
>> HARD_REGNO_MODE_OK.  How do we tell GCC that the real and imaginary
>> parts are actually packed into a single register?  I tried defining
>> two RTLs to pack and unpack the two parts using the concat:CHI
>> operation.
>
> I don't think the gcc middle-end has any support for machines which provide
> special handling for complex int.  I think the middle-end always breaks up
> complex int operations into pairs of int operations.  So to make this work you
> would probably have to add that support.
>
> Ian
>

Thanks Ian for the reply.  Can you please point me to the files in the
middle-end where I may find the relevant code?

  reply	other threads:[~2011-10-18 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 16:31 Ayonam Ray
2011-10-18 17:08 ` Ian Lance Taylor
2011-10-18 17:20   ` Ayonam Ray [this message]
2011-10-18 17:38     ` Ian Lance Taylor
2011-10-18 17:46       ` Ayonam Ray
2011-10-18 17:54         ` Ian Lance Taylor
2011-10-18 18:07           ` Ayonam Ray

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='CA+V5N8=Uhhu1jNnyBqgV_VxrpXpFHV9Ze9UjTLF4-TvOWphLow@mail.gmail.com' \
    --to=ayonam@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.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).