public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Meissner <meissner@linux.ibm.com>
To: jeevitha <jeevitha@linux.vnet.ibm.com>
Cc: gcc-patches@gcc.gnu.org, segher@kernel.crashing.org,
	meissner@linux.ibm.com, Peter Bergner <bergner@linux.ibm.com>
Subject: Re: [PATCH] rs6000: Fix issue in specifying PTImode as an attribute [PR106895]
Date: Thu, 24 Aug 2023 13:35:13 -0400	[thread overview]
Message-ID: <ZOeU0TYMPgAf4PFQ@cowardly-lion.the-meissners.org> (raw)
In-Reply-To: <460cd2bd-7c82-95d8-c58e-f32da70ab2a9@linux.vnet.ibm.com>

On Thu, Jul 20, 2023 at 10:05:28AM +0530, jeevitha wrote:
> Hi All,
> 
> The following patch has been bootstrapped and regtested on powerpc64le-linux.
> 
> When the user specifies PTImode as an attribute, it breaks. Created
> a tree node to handle PTImode types. PTImode attribute helps in generating
> even/odd register pairs on 128 bits.
> 
> 2023-07-20  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>
> 
> gcc/
> 	PR target/110411
> 	* config/rs6000/rs6000.h (enum rs6000_builtin_type_index): Add fields
> 	to hold PTImode type.
> 	* config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Add node
> 	for PTImode type.
> 
> gcc/testsuite/
> 	PR target/106895
> 	* gcc.target/powerpc/pr106895.c: New testcase.

It is good as far as it goes, but I suspect we will eventually need to extend
it.  In particular, the reason people need PTImode is they need the even/odd
register layout.  What you've done enables users to declare this value.

However, it is likely the users (kernel users mostly) will want to use it with
the atomic built-in functions that take 16 byte values.  So I suspect we will
need to add overloads for those built-ins to allow either TImode and PTImode to
be used.  Note, the PTImode built-in would bypass the TImode parts where they
convert a TImode into PTImode.

This is the reason PTImode was created in the first place.  Due to the calling
sequence, TImode could be passed in odd/even (as well as even/odd) register
pairs, but the atomic insns and lq/stq need even/odd register pairs.  But if
you are calling a built-in with PTImode, you don't have to convert it to
PTImode.

But then the next problem is what happens when people start using it.  Do we
need to add all of the TImode insns (Add, subtract, and, ior, xor, shifts at
the very least)?  These are the things I expect people might want to do for
memory accessed via atomic insns.

Then we get to the thorny problems of load/store on little endian systems, and
do we define the order of the two registers.  Unfortunately, the lq/stq
instructions will load words in the opposite order as plq/pstq.  I imagine the
kernel folk want to use lq/stq, but we may have to figure out exactly what they
want.

If we define any form of operation on PTImode, we likely need to define whether
register 0 has the high bits or low bits.

Sorry to be so negative, but those are a lot of the issues that might come up
as people use it.


-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com

  parent reply	other threads:[~2023-08-24 17:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  4:35 jeevitha
2023-08-04 10:12 ` [PING ^1][PATCH] " jeevitha
2023-08-09  8:48 ` [PATCH] " Kewen.Lin
2023-08-24 17:35 ` Michael Meissner [this message]
2023-08-25  2:19   ` Peter Bergner
2023-08-26  8:37     ` Michael Meissner
2023-11-13 15:08     ` [PING ^1][PATCH] " jeevitha
2023-12-11 19:11       ` [PING ^3][PATCH] " jeevitha
     [not found] <9ea38d87-180f-46b5-a723-45061680980f@linux.vnet.ibm.com>
2024-02-23  9:34 ` [PATCH] " jeevitha
2024-03-18 14:36   ` Segher Boessenkool
2024-03-18 17:35     ` Peter Bergner

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=ZOeU0TYMPgAf4PFQ@cowardly-lion.the-meissners.org \
    --to=meissner@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeevitha@linux.vnet.ibm.com \
    --cc=segher@kernel.crashing.org \
    /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).