public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16796] New: PowerPC - Unnecessary Floating Point Register Copy
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
2004-07-29 5:37 ` [Bug rtl-optimization/16796] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-28 17:01 UTC (permalink / raw)
To: gcc-bugs
Description:
A non-optimal code sequence is illustraded. A floating point register copy is unnecessary and could be eliminated. Duplicate using gcc 3.5 and command line:
gcc -O3 -m64 -c test.c
Testcase:
static const double huge = 1.0e300;
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
double __floor(double x)
{
union {
double dbl_val;
long int long_val;
} temp;
int64_t i0,j0;
u_int64_t i;
temp.dbl_val = x;
i0 = temp.long_val;
j0 = ((i0>>52)&0x7ff)-0x3ff;
if(j0<52) {
if(j0<0) {
if(huge+x>0.0) {
if(i0>=0) {i0=0;}
else if((i0&0x7fffffffffffffff)!=0)
{ i0=0xbff0000000000000;}
}
} else {
i = (0x000fffffffffffff)>>j0;
if((i0&i)==0) return x;
if(huge+x>0.0) {
if(i0<0) i0 += (0x0010000000000000)>>j0;
i0 &= (~i);
}
}
} else {
if (j0==0x400)
return x+x;
else
return x;
}
temp.long_val = i0;
x = temp.dbl_val;
return x;
}
Assembly:
.__floor:
stfd 1,-16(1)
ld 0,-16(1)
rldicl 9,0,12,53
mr 11,0
addi 9,9,-1023
cmpdi 7,9,51
bgt- 7,.L2
cmpdi 7,9,0
blt- 7,.L20
li 0,-1
extsw 9,9
rldicl 0,0,0,12
srad 10,0,9
and. 0,10,11
beqlr- 0
lfd 0,.LC0@toc(2)
lfd 13,.LC1@toc(2)
fadd 0,1,0
fcmpu 7,0,13
bng- 7,.L6
cmpdi 7,11,0
blt- 7,.L21
.L16:
andc 11,11,10
.L6:
std 11,-16(1)
lfd 0,-16(1) <-- Load directly into float reg 1 and
fmr 1,0 <-- avoid subsequent copy.
blr
.L2:
cmpdi 7,9,1024
bnelr+ 7
fadd 1,1,1
blr
.L20:
lfd 0,.LC0@toc(2)
lfd 13,.LC1@toc(2)
fadd 0,1,0
fcmpu 7,0,13
bng- 7,.L6
cmpdi 7,0,0
blt- 7,.L22
li 11,0
b .L6
.L21:
lis 0,0x10
sldi 0,0,32
srad 0,0,9
add 11,11,0
b .L16
.L22:
rldicl. 0,11,0,1
beq- 0,.L6
lis 11,0xbff0
sldi 11,11,32
b .L6
--
Summary: PowerPC - Unnecessary Floating Point Register Copy
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steinmtz at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-29 5:37 ` pinskia at gcc dot gnu dot org
2004-10-08 13:11 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-29 5:37 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|target |rtl-optimization
Keywords| |missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
2004-07-29 5:37 ` [Bug rtl-optimization/16796] " pinskia at gcc dot gnu dot org
@ 2004-10-08 13:11 ` pinskia at gcc dot gnu dot org
2004-11-10 11:01 ` nathan at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-08 13:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-08 13:11 -------
Confirmed, the problem is related to the register allocator.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-10-08 13:11:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
2004-07-29 5:37 ` [Bug rtl-optimization/16796] " pinskia at gcc dot gnu dot org
2004-10-08 13:11 ` pinskia at gcc dot gnu dot org
@ 2004-11-10 11:01 ` nathan at gcc dot gnu dot org
2004-11-10 12:28 ` nathan at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-10 11:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-10 11:01 -------
The fault is not the register allocator, is is a problem introduced by flow2 and
the existance of conditional returns on PPC. During register allocation
there is one exit block. The returns are 'x, x, x+x & x', thus the global
allocator sets the exit block to copy 'x' to the return register. flow2
replaces some of those branches to the exit block with conditional returns,
because 'x' resides in both DF:33 and DF:32. The remaining use of the exit
is the load from the union into DF:32, the location of 'x' during the function.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-11-10 11:01 ` nathan at gcc dot gnu dot org
@ 2004-11-10 12:28 ` nathan at gcc dot gnu dot org
2004-11-11 8:47 ` nathan at gcc dot gnu dot org
2004-11-11 8:49 ` cvs-commit at gcc dot gnu dot org
5 siblings, 0 replies; 10+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-10 12:28 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |nathan at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-11-10 12:28 ` nathan at gcc dot gnu dot org
@ 2004-11-11 8:47 ` nathan at gcc dot gnu dot org
2004-11-11 8:49 ` cvs-commit at gcc dot gnu dot org
5 siblings, 0 replies; 10+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-11 8:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-11-11 08:47 -------
2004-11-11 Nathan Sidwell <nathan@codesourcery.com>
PR target/16796
* config/rs6000/rs6000.md: Add DF & SF reg move peepholes.
partial fix. Now we need a better reg-alloc
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |18427
AssignedTo|nathan at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-11-11 8:47 ` nathan at gcc dot gnu dot org
@ 2004-11-11 8:49 ` cvs-commit at gcc dot gnu dot org
5 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-11 8:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-11 08:49 -------
Subject: Bug 16796
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: nathan@gcc.gnu.org 2004-11-11 08:49:17
Modified files:
gcc : ChangeLog
gcc/config/rs6000: rs6000.md
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: ppc-mov-1.c
Log message:
.:
PR target/16796
* config/rs6000/rs6000.md: Add DF & SF reg move peepholes.
testsuite:
PR target/16796
* gcc.dg/ppc-mov-1.c: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6272&r2=2.6273
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&r1=1.332&r2=1.333
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4575&r2=1.4576
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ppc-mov-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16796
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-09-14 4:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-16796-8614@http.gcc.gnu.org/bugzilla/>
2005-10-04 6:26 ` [Bug rtl-optimization/16796] PowerPC - Unnecessary Floating Point Register Copy pinskia at gcc dot gnu dot org
2005-11-02 17:16 ` pinskia at gcc dot gnu dot org
2006-06-08 6:10 ` pinskia at gcc dot gnu dot org
2008-09-14 4:09 ` pinskia at gcc dot gnu dot org
2004-07-28 17:01 [Bug other/16796] New: " gcc-bugzilla at gcc dot gnu dot org
2004-07-29 5:37 ` [Bug rtl-optimization/16796] " pinskia at gcc dot gnu dot org
2004-10-08 13:11 ` pinskia at gcc dot gnu dot org
2004-11-10 11:01 ` nathan at gcc dot gnu dot org
2004-11-10 12:28 ` nathan at gcc dot gnu dot org
2004-11-11 8:47 ` nathan at gcc dot gnu dot org
2004-11-11 8:49 ` cvs-commit 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).