public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function
@ 2014-10-03 10:46 lc at luiscoloradosistemas dot com
2014-10-03 10:57 ` [Bug c/63450] " lc at luiscoloradosistemas dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: lc at luiscoloradosistemas dot com @ 2014-10-03 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450
Bug ID: 63450
Summary: Optimizing -O3 generates rep ret on an almost empty
function
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: lc at luiscoloradosistemas dot com
When I try to compile this piece of code:
$ cat pru.c
void f()
{
int b=0;
}
using
gcc -O3 -S -o pru.S pru.c
I get this assembler output:
$ gcc -O3 -S -o - pru.c
.file "pru.c"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
rep <<<<<<<<< string prefix just before a ret ???
ret
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-3)"
.section .note.GNU-stack,"",@progbits
In some other cases I have got even the `rep' and the `ret' in the same line,
so the assembler complained about it (in release 2.20 of the assembler, not in
later 2.23.2) with this piece of code:
$ cat program.c
#include <stdio.h>
void printer(void)
{
int a=0;
printf("%d\n", a);
}
void setter(void)
{
int b = 42;
}
int main()
{
setter();
printer();
return 0;
}
arch: Linux ***** 2.6.32-358.23.2.el6.x86_64 #1 SMP Sat Sep 14 05:32:37 EDT
2013 x86_64 x86_64 x86_64 GNU/Linux
compiler version:
gcc-4.8 (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/63450] Optimizing -O3 generates rep ret on an almost empty function
2014-10-03 10:46 [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function lc at luiscoloradosistemas dot com
@ 2014-10-03 10:57 ` lc at luiscoloradosistemas dot com
2014-10-03 14:29 ` andi-gcc at firstfloor dot org
2014-10-06 14:53 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: lc at luiscoloradosistemas dot com @ 2014-10-03 10:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450
--- Comment #1 from Luis Colorado <lc at luiscoloradosistemas dot com> ---
when i compile a completely empty function i get the rep ret in the same line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/63450] Optimizing -O3 generates rep ret on an almost empty function
2014-10-03 10:46 [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function lc at luiscoloradosistemas dot com
2014-10-03 10:57 ` [Bug c/63450] " lc at luiscoloradosistemas dot com
@ 2014-10-03 14:29 ` andi-gcc at firstfloor dot org
2014-10-06 14:53 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: andi-gcc at firstfloor dot org @ 2014-10-03 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450
Andi Kleen <andi-gcc at firstfloor dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andi-gcc at firstfloor dot org
--- Comment #2 from Andi Kleen <andi-gcc at firstfloor dot org> ---
This is a feature in -mtune=generic because it helps branch prediction in some
older AMD CPUs. If you're optimizing for Atom you'll get even more padding due
to other reasons. Optimizing e.g. for nehalem should avoid it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/63450] Optimizing -O3 generates rep ret on an almost empty function
2014-10-03 10:46 [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function lc at luiscoloradosistemas dot com
2014-10-03 10:57 ` [Bug c/63450] " lc at luiscoloradosistemas dot com
2014-10-03 14:29 ` andi-gcc at firstfloor dot org
@ 2014-10-06 14:53 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-06 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63450
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
feature.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-06 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-03 10:46 [Bug c/63450] New: Optimizing -O3 generates rep ret on an almost empty function lc at luiscoloradosistemas dot com
2014-10-03 10:57 ` [Bug c/63450] " lc at luiscoloradosistemas dot com
2014-10-03 14:29 ` andi-gcc at firstfloor dot org
2014-10-06 14:53 ` rguenth at gcc dot gnu.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).