public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Meissner <meissner@linux.ibm.com>
To: Michael Meissner <meissner@linux.ibm.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	gcc-patches@gcc.gnu.org, "Kewen.Lin" <linkw@linux.ibm.com>,
	David Edelsohn <dje.gcc@gmail.com>,
	Peter Bergner <bergner@linux.ibm.com>,
	Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: Re: [PATCH 0/6] PowerPC Dense Math prelimary support (-mcpu=future)
Date: Tue, 31 Jan 2023 22:31:03 -0500	[thread overview]
Message-ID: <Y9nc9zStwWpFH3Cq@toto.the-meissners.org> (raw)
In-Reply-To: <Y9cw9mQCZBX+3urq@toto.the-meissners.org>

On Sun, Jan 29, 2023 at 09:52:38PM -0500, Michael Meissner wrote:
> On Sat, Jan 28, 2023 at 02:29:04AM -0500, Michael Meissner wrote:
> > On Fri, Jan 27, 2023 at 01:59:00PM -0600, Segher Boessenkool wrote:
> > > > There is one bug that I noticed.  When you use the full DMR instruction the
> > > > constant copy propagation patch issues internal errors.  I believe this is due
> > > > to the CCP pass not handling opaque types cleanly enough, and it only shows up
> > > > in larger types.  I would like to get these patches committed, and then work
> > > > the maintainers of the CCP to fix the problem.
> > > 
> > > Erm.  If the compiler ICEs, we can not include this code.  But hopefully
> > > you mean something else?
> > 
> > I realize we can't include the code for final release.  But as a temporary
> > measure I was hoping we would put in the code, we could allow somebody more
> > familar with ccp to debug it.  Then if there were changes needed in the PowerPC
> > back end, we could make them, once ccp was fixed.
> > 
> > But that is a moot point, ccp no longer dies with the code, so I have removed
> > the comment and the no tree ccp option in the next set of patches.
> 
> Unfortunately, while it worked on my x86 as a cross compiler, when I did the
> builds for real, it is a problem, so I will need to look into it.

Ok, I tracked down the source of the bug.  The CCP pass is depending on the
precision field.  Unfortunately in tree-core.h, the precision is a 10 integer
bit field, so 1,024 will become 0.

Having a 0 precision meant that the hwint function for sign extending a value
would generate:

	(HOST_WIDE_INT)(((unsigned HOST_WIDE_INT)value << 64) >> 64)

which is undefined behavior in C and C++.  On the x86_64 doing the shift left
and then right gives you the initial value (which was -1), while on the PowerPC
it always gives you 0.  The CCP code was assuming if it wasn't -1, that it was
an integer, but the TDO type is opaque, not integer.

The solution was to grow precision by 1 bit and decrease the extra bits in the
placeholder entry by 1 bit.  I'm testing it now.

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

  reply	other threads:[~2023-02-01  3:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  2:43 Michael Meissner
2022-11-10  2:44 ` [PATCH 1/6] PowerPC: Add -mcpu=future Michael Meissner
2022-11-11 21:07   ` Peter Bergner
2023-01-20 21:05   ` Ping: " Michael Meissner
2023-01-27 20:00     ` Segher Boessenkool
2022-11-10  2:45 ` [PATCH 2/6] PowerPC: Make -mcpu=future enable -mblock-ops-vector-pair Michael Meissner
2023-01-20 21:07   ` Ping: " Michael Meissner
2022-11-10  2:46 ` [PATCH 3/6] PowerPC: Add support for accumulators in DMR registers Michael Meissner
2023-01-20 21:08   ` Ping: " Michael Meissner
2022-11-10  2:50 ` [PATCH 4/6] PowerPC: Make MMA insns support " Michael Meissner
2023-01-20 21:10   ` Ping: " Michael Meissner
2022-11-10  2:51 ` [PATCH 5/6] PowerPC: Switch to dense math names for all MMA operations Michael Meissner
2023-01-20 21:11   ` Ping: " Michael Meissner
2022-11-10  2:52 ` [PATCH 6/6] PowerPC: Add support for 1,024 bit DMR registers Michael Meissner
2023-01-20 21:12   ` Ping: " Michael Meissner
2022-11-12  5:07 ` [PATCH 7] PowerPC: Add -mcpu=future saturating subtract built-ins Michael Meissner
2023-01-20 21:13   ` Ping: " Michael Meissner
2022-11-12  5:10 ` [PATCH 8] PowerPC: Support load/store vector with right length Michael Meissner
2023-01-20 21:15   ` Patch: " Michael Meissner
2023-01-27 19:59 ` [PATCH 0/6] PowerPC Dense Math prelimary support (-mcpu=future) Segher Boessenkool
2023-01-28  7:29   ` Michael Meissner
2023-01-30  2:52     ` Michael Meissner
2023-02-01  3:31       ` Michael Meissner [this message]
2023-02-02  0:05         ` 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=Y9nc9zStwWpFH3Cq@toto.the-meissners.org \
    --to=meissner@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    --cc=will_schmidt@vnet.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).