On Mon, May 10, 2021 at 10:21:04AM +0200, Richard Biener wrote: > On Sun, 9 May 2021, Segher Boessenkool wrote: > > On Sun, May 09, 2021 at 12:54:08AM +0800, Xi Ruoyao via Gcc-help wrote: > > > On Sat, 2021-05-08 at 20:07 +0800, 172060045@xxxxxxxxxx wrote: > > > > Recently I noticed that gcc -O2 didn't turn on vectorization > > > > optimization, > > > > which it turns on in clang -O2. > > > > > > > > Does GCC think it involves the trade-off of space speed, or other > > > > considerations? > > > > -O2 is for optimisations that (almost) never degrade code quality. -O3 > > is for those that are only beneficial "on average". > > In particular -O2 is a balance of compile-time, generated code size > and resulting performance. Yeah, sorry, I glossed over those details, but they do matter. My point is that -O2 opts "almost never" should degrade quality (code speed, code size, compilation speed, and tradeoffs in that all -- nothing is a hard and fast rule here). > Vectorization with the -O2 default > cost model of "cheap" tends to mostly increase the first and the second > whilst only moderately affecting the last. One promising plan is to use very-cheap instead. It should increase code size even less (but see what Honza said). > It's all of course hugely dependent on the source base you are > working with. Yeah. Segher