public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: roy rosen <roy.1rosen@gmail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc@gcc.gnu.org
Subject: Re: inline assembly vs. intrinsic functions
Date: Thu, 24 Mar 2011 13:50:00 -0000	[thread overview]
Message-ID: <AANLkTi=+Neymhkn5TSP84mkyYaMxj7c239uioVaLLURg@mail.gmail.com> (raw)
In-Reply-To: <mcrzkoocay8.fsf@google.com>

2011/3/22 Ian Lance Taylor <iant@google.com>:
> roy rosen <roy.1rosen@gmail.com> writes:
>
>> 2010/10/26 Ian Lance Taylor <iant@google.com>:
>>> roy rosen <roy.1rosen@gmail.com> writes:
>>>
>>>> I am trying to demonstrate my port capabilities.
>>>> I am writing an application which needs to use instructions like max
>>>> a,b,c,d,e,f where a,b,c are inputs and d,e,f are outputs.
>>>> Is that possible to write an intrinsic function for that?
>>>> I think not because that means that I need to pass d,e,f by reference
>>>> which means that they would be in memory and not in a register as
>>>> meant by the instruction.
>>>
>>> That is correct.  An intrinsic function is a normal function.  If you
>>> want it to have multiple outputs, you need to pass in addresses, or you
>>> need to have it return a struct.
>>>
>>> I'm a bit curious as to why a function named max would have multiple
>>> outputs.
>>>
>>>> Is there any port with such an example?
>>>
>>> Not to my knowledge.  I wrote a private port in which some intrinsics
>>> returned a struct, and to keep everything out of memory I added
>>> additional intrinsics to retrieve elements of the struct.  It's awkward
>>> to use but the resulting code is fine.
>>>
>> Can you please explain how this solution should work?
>> First a code with memory accesses would be generated and then
>> optimizations would optimize it to use registers directly?
>
> You build a RECORD_TYPE holding the fields you want to return.  You
> define the appropriate builtin functions to return that record type.

How is that done? using define_insn? How do I tell it to return a struct?
Is there an example I can look at?

Roy.

> You define another builtin function for each field, which takes the
> RECORD_TYPE as its argument and returns the type of the field.  In
> TARGET_FOLD_BUILTIN you convert the per-field functions into
> COMPONENT_REFs.
>
> Ian
>

  reply	other threads:[~2011-03-24 12:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26  5:54 roy rosen
2010-10-26 13:31 ` Ian Lance Taylor
2010-10-26 13:36   ` roy rosen
2010-10-26 15:01     ` roy rosen
2010-10-26 16:12       ` Ian Lance Taylor
2010-11-15 16:05         ` roy rosen
2010-11-15 16:06           ` Joern Rennecke
2010-11-15 16:55             ` roy rosen
2010-11-15 19:11           ` Ian Lance Taylor
2011-03-17 11:34   ` roy rosen
2011-03-21 23:26     ` Ian Lance Taylor
2011-03-24 13:50       ` roy rosen [this message]
2011-03-24 17:38         ` Ian Lance Taylor
2011-03-28 11:36           ` roy rosen
2011-03-28 17:37             ` Ian Lance Taylor

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='AANLkTi=+Neymhkn5TSP84mkyYaMxj7c239uioVaLLURg@mail.gmail.com' \
    --to=roy.1rosen@gmail.com \
    --cc=gcc@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).