public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/41742] New: Unnecessary zero-extension at -O2 but not -O1
@ 2009-10-18 13:56 segher at kernel dot crashing dot org
0 siblings, 0 replies; only message in thread
From: segher at kernel dot crashing dot org @ 2009-10-18 13:56 UTC (permalink / raw)
To: gcc-bugs
Take the following example:
void *memset(void *b, int c, unsigned long len)
{
unsigned long i;
for (i = 0; i < len; i++)
((unsigned char *)b)[i] = c;
return b;
}
-O2 generates:
memset:
cmpwi 0,5,0
beqlr 0
mtctr 5
rlwinm 4,4,0,0xff
li 9,0
.p2align 4,,15
.L3:
stbx 4,3,9
addi 9,9,1
bdnz .L3
blr
The zero-extension of GPR4 isn't needed, and in fact, -O1 doesn't
generate it:
memset:
cmpwi 0,5,0
beqlr 0
li 9,0
subf 5,9,5
mtctr 5
.L3:
stbx 4,3,9
addi 9,9,1
bdnz .L3
blr
(the subf here is superfluous though).
--
Summary: Unnecessary zero-extension at -O2 but not -O1
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: segher at kernel dot crashing dot org
GCC target triplet: powerpc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41742
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-10-18 13:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-18 13:56 [Bug middle-end/41742] New: Unnecessary zero-extension at -O2 but not -O1 segher at kernel dot crashing 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).