7 ms·
Doesn't gcc's "-funroll-loops" do the same thing? This looks more manual work to me, unrolling loops by hand.
by shared4you 13y ago
Doesn't gcc's "-funroll-loops" do the same thing? This looks more manual work to me, unrolling loops by hand.
- gillianseed 13y agoIt does but the heuristics for loop unrolling without any runtime data as basis is very difficult and thus very much a hit or miss affair (and missing is expensive) which is why no compiler I know of (GCC included) enables -funroll-loops or equivalent by default in any of the standard optimization levels (-On). In GCC, the only option which enables -funroll-loops (apart from explicitly enabling it) is -fprofile-generate which is GCC's profile guided optimization. The reason it enables -funroll-loops is that since it gathers runtime statistics during the profiling run it has enough information to accurately perform loop unrolling without risking performance degradation.