This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug regression/16456] New: PowerPC - redundant subtract involving pointer types
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2004 18:05:31 -0000
- Subject: [Bug regression/16456] New: PowerPC - redundant subtract involving pointer types
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Description:
A non-optimal code sequence is illustrated. Two subtract operations are
done where only one is necessary. Duplicate using gcc 3.5 and command
line:
gcc -O3 -m64 -c test.c
Testcase:
char * ptr1;
char * ptr2;
int x;
long int y;
void foo ()
{
x = ptr1 - ptr2;
y = ptr1 - ptr2;
}
Assembly:
ld 9,.LC0@toc(2)
ld 11,.LC1@toc(2)
ld 0,0(9)
ld 10,0(11)
ld 8,.LC3@toc(2)
subf 11,10,0
ld 9,.LC2@toc(2)
subf 0,10,0 -- no need to do this subtract, just use the previous
result.
std 11,0(8)
stw 0,0(9)
blr
--
Summary: PowerPC - redundant subtract involving pointer types
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: regression
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=16456