public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code
@ 2006-01-26 12:24 amodra at bigpond dot net dot au
2006-01-26 12:28 ` [Bug rtl-optimization/25972] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-01-26 12:24 UTC (permalink / raw)
To: gcc-bugs
Compile the following with -m64 -mlong-double-128 -O2 -S
long double
pack (double a, double aa)
{
union { long double ld; double d[2]; } u;
u.d[0] = a;
u.d[1] = aa;
return u.ld;
}
void
unpack (long double x, double *a, double *aa)
{
union { long double ld; double d[2]; } u;
u.ld = x;
*a = u.d[0];
*aa = u.d[1];
}
Results in
[snip]
.L.pack:
stfd 1,-176(1)
stfd 14,-144(1)
nop
nop
ld 9,-176(1)
stfd 2,-176(1)
std 9,-160(1)
nop
ld 10,-176(1)
std 10,-152(1)
lfd 13,-160(1)
fmr 1,13
lfd 14,-152(1)
fmr 2,14
lfd 14,-144(1)
blr
[snip]
.L.unpack:
stfd 1,-16(1)
stfd 2,-8(1)
nop
nop
ld 11,-16(1)
ld 12,-8(1)
std 11,0(5)
std 12,0(6)
blr
This ought to be
.L.pack:
blr
.L.unpack:
stfd 1,0(5)
stfd 2,0(6)
blr
ie. packing and unpacking long doubles ought to be nops. Instead we see
needless moving between fprs and gprs via memory. This problem affects
functions like __gcc_qadd from rs6000/darwin-ldouble.c
--
Summary: pack and unpack of long doubles via union generates poor
code
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/25972] pack and unpack of long doubles via union generates poor code
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
@ 2006-01-26 12:28 ` pinskia at gcc dot gnu dot org
2007-11-03 17:55 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-26 12:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-01-26 12:28 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC target triplet|powerpc64-linux |powerpc*-*-*
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-01-26 12:28:08
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/25972] pack and unpack of long doubles via union generates poor code
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
2006-01-26 12:28 ` [Bug rtl-optimization/25972] " pinskia at gcc dot gnu dot org
@ 2007-11-03 17:55 ` pinskia at gcc dot gnu dot org
2007-11-03 18:05 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-03 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-11-03 17:55 -------
The true cause of this is giving the union, TImode. For the PS3 compiler, I
remove the definition of MAX_FIXED_MODE_SIZE for performance reasons of unions
that had vectors in it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/25972] pack and unpack of long doubles via union generates poor code
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
2006-01-26 12:28 ` [Bug rtl-optimization/25972] " pinskia at gcc dot gnu dot org
2007-11-03 17:55 ` pinskia at gcc dot gnu dot org
@ 2007-11-03 18:05 ` pinskia at gcc dot gnu dot org
2009-06-11 1:07 ` bje at gcc dot gnu dot org
2010-04-12 17:45 ` bergner at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-03 18:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-11-03 18:05 -------
Doing that (removing MAX_FIXED_MODE_SIZE), gets us:
.pack:
stfd 1,-16(1)
stfd 2,-8(1)
lfd 1,-16(1)
lfd 2,-8(1)
blr
.unpack:
stfd 1,-16(1)
stfd 2,-8(1)
lfd 0,-16(1)
lfd 13,-8(1)
stfd 0,0(5)
stfd 13,0(6)
blr
which is much better for pack (less LHS on cell).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/25972] pack and unpack of long doubles via union generates poor code
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
` (2 preceding siblings ...)
2007-11-03 18:05 ` pinskia at gcc dot gnu dot org
@ 2009-06-11 1:07 ` bje at gcc dot gnu dot org
2010-04-12 17:45 ` bergner at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-06-11 1:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from bje at gcc dot gnu dot org 2009-06-11 01:07 -------
Subject: Bug 25972
Author: bje
Date: Thu Jun 11 01:06:53 2009
New Revision: 148363
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148363
Log:
2009-06-11 Alan Modra <amodra@au.ibm.com>
PR target/25972
* config/rs6000/darwin-ldouble.c (longDblUnion): Delete.
(pack): New inline function. Use throughout in place of packing a
pair of doubles to long double via union.
Modified:
branches/ibm/gcc-4_3-branch/gcc/ChangeLog.ibm
branches/ibm/gcc-4_3-branch/gcc/config/rs6000/darwin-ldouble.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/25972] pack and unpack of long doubles via union generates poor code
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
` (3 preceding siblings ...)
2009-06-11 1:07 ` bje at gcc dot gnu dot org
@ 2010-04-12 17:45 ` bergner at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: bergner at gcc dot gnu dot org @ 2010-04-12 17:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from bergner at gcc dot gnu dot org 2010-04-12 17:45 -------
Subject: Bug 25972
Author: bergner
Date: Mon Apr 12 17:44:59 2010
New Revision: 158231
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158231
Log:
Backport from ibm/gcc-4_3-branch
2009-06-11 Alan Modra <amodra@au.ibm.com>
PR target/25972
* config/rs6000/darwin-ldouble.c (longDblUnion): Delete.
(pack): New inline function. Use throughout in place of packing a
pair of doubles to long double via union.
Modified:
branches/ibm/gcc-4_4-branch/gcc/ChangeLog.ibm
branches/ibm/gcc-4_4-branch/gcc/config/rs6000/darwin-ldouble.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25972
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-12 17:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-26 12:24 [Bug rtl-optimization/25972] New: pack and unpack of long doubles via union generates poor code amodra at bigpond dot net dot au
2006-01-26 12:28 ` [Bug rtl-optimization/25972] " pinskia at gcc dot gnu dot org
2007-11-03 17:55 ` pinskia at gcc dot gnu dot org
2007-11-03 18:05 ` pinskia at gcc dot gnu dot org
2009-06-11 1:07 ` bje at gcc dot gnu dot org
2010-04-12 17:45 ` bergner at gcc dot gnu dot org
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).