Re: -Os versus -O2
- From: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Jun 2007 09:03:35 +0200
then do we need a new option 'optimize for best overall performance' that goes for size (and the corresponding wins there) most of the time, but is ignored where it makes a huge difference?
That's -Os mostly. Some awful CPUs really need higher
loop/label/function alignment though to get any
performance; you could add -falign-xxx options for those.
in reality this was a flaw in gcc that on modern CPU's with the larger difference between CPU speed and memory speed it still preferred to unroll loops (eating more memory and blowing out the cpu cache) when it shouldn't have.
You told it to unroll loops, so it did. No flaw. If you
feel the optimisations enabled by -O2 should depend on the
CPU tuning selected, please file a PR.
Also note that whether or not it is profitable to unroll
a particular loop depends largely on how "hot" that loop
is, and GCC doesn't know much about that if you don't feed
it profiling information (it can guess a bit, sure, but it
can guess wrong too).
Segher
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: -Os versus -O2
- From: david
- Re: -Os versus -O2
- References:
- [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Denis Cheng
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Oleg Verych
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: rae l
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Oleg Verych
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Arjan van de Ven
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Benjamin LaHaise
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Arjan van de Ven
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Benjamin LaHaise
- Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- From: Arjan van de Ven
- -Os versus -O2
- From: Adrian Bunk
- Re: -Os versus -O2
- From: Arjan van de Ven
- Re: -Os versus -O2
- From: david
- [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization
- Prev by Date: Re: 2.6.22-rc3 nmi watchdog hang
- Next by Date: Re: -Os versus -O2
- Previous by thread: Re: -Os versus -O2
- Next by thread: Re: -Os versus -O2
- Index(es):
Relevant Pages
|