public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Bert Tenjy <tnggil@protonmail.com>
Cc: gcc-patches@gcc.gnu.org, segher@kernel.crashing.org,
	dje.gcc@gmail.com, wschmidt@linux.ibm.com, tuliom@linux.ibm.com,
	Bert Tenjy <tnggil@gmail.com>
Subject: Re: [RFC PATCH v1 1/1] PPC64: Implement POWER Architecture Vector Function ABI.
Date: Fri, 7 Aug 2020 22:59:05 +0200	[thread overview]
Message-ID: <20200807205905.GD2363@tucnak> (raw)
In-Reply-To: <1596832552-111518-1-git-send-email-tnggil@protonmail.com>

On Fri, Aug 07, 2020 at 08:35:52PM +0000, Bert Tenjy via Gcc-patches wrote:
> The document describing POWER Architecture Vector Function interface is
> tentatively at: https://sourceware.org/glibc/wiki/Homepage?action=AttachFile&do=view&target=powerarchvectfuncabi.html

Doesn't exist.

> +  if (TARGET_VSX)
> +    {
> +      clonei->vecsize_mangle = 'b';
> +      ret = 1;
> +    }
> +  clonei->mask_mode = VOIDmode;
> +  switch (clonei->vecsize_mangle)
> +    {
> +    case 'b':
> +      clonei->vecsize_int = 128;
> +      clonei->vecsize_float = 128;
> +      break;
> +    case 'c':
> +      clonei->vecsize_int = 128;
> +      clonei->vecsize_float = 128;

So what is this 'c' case here for?

> +      break;
> +    default:
> +      gcc_unreachable ();

If (!TARGET_VSX), this will abort (as you only set vecsize_mangle to 'b'
if TARGET_VSX, otherwise nothing sets it (so it remains 0).

The way this works is that the caller calls the target hook with 0
as last argument, and the hook either returns 0 (means not supported at
all), or returns number of supported variants and provides the first one.
If more than one are supported, the caller will keep iterating on those.
E.g. on x86, we support 4 modes (b, c, d, e) for exported functions and
for non-exported ones just choose a single one based on the ISA, because in
that case it is not a matter of ABI.

For PowerPC, if all you want to support is b which requires VSX, then the
right thing is for !TREE_PUBLIC functions return 0 if !TARGET_VSX and
otherwise set vecsize_mangle to 'b' and in the end return 1, for exported
functions always set it to 'b' (and in the end return 1).
Then ensure that the 'b' variants of function definitions get target ("vsx")
attribute added if !TARGET_VSX.

That way, e.g. on powerpc64 big endian, the declare simd variants will be
provided for exported functions, but code will only use them if the caller
is TARGET_VSX compiled.

	Jakub


  reply	other threads:[~2020-08-07 20:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 20:35 Bert Tenjy
2020-08-07 20:59 ` Jakub Jelinek [this message]
2020-08-10 17:29   ` GT
2020-08-10 18:07     ` Jakub Jelinek
2020-08-13 20:40       ` GT
2020-08-13 21:00         ` Jakub Jelinek
2020-08-20 19:31           ` GT
2020-08-20 20:04             ` Jakub Jelinek
2020-08-20 20:29             ` Segher Boessenkool
2020-08-13 22:49 ` Segher Boessenkool
2020-08-17 17:44   ` GT
2020-08-17 21:28     ` Segher Boessenkool
2020-08-18 19:14       ` GT
2020-08-18 21:32         ` Segher Boessenkool
2020-08-20 16:19           ` GT
2020-08-20 17:48             ` Segher Boessenkool
2020-12-04 18:28               ` GT
2020-08-17 22:05     ` David Edelsohn
2020-08-17 23:06       ` Segher Boessenkool

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=20200807205905.GD2363@tucnak \
    --to=jakub@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=tnggil@gmail.com \
    --cc=tnggil@protonmail.com \
    --cc=tuliom@linux.ibm.com \
    --cc=wschmidt@linux.ibm.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).