loop: will this optimize?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: gcc-help@xxxxxxxxxxx
- Subject: loop: will this optimize?
- From: pieniek <edek.pienkowski@xxxxxxxxx>
- Date: Thu, 14 Apr 2011 19:08:37 +0200
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Linux/3.1.0-15 Thunderbird/3.1.0
Hi,
if a loop contains if-s on a constant boolean, will gcc create two loop
versions, for the boolean being true and the boolean being false, if the
boolean switches on some heavy code (in this case, costly debugging
code)? The boolean in question being not a template param or not really
const either, just constant during the loop run.
I do understand that if the boolean is off (no heavy code) this does
boils down to a couple of jumps not taken or taken, but, with these ifs
removed, the loop can benefit from things like vectorisation. Right?
So, the question rephrased, is there any benefit of templating some
function containing a loop based on the bool value (or writing the code
in both versions anyhow)? The goal would be to make the fast (call it
release) version of the loop really fast.
Edek
[Index of Archives]
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]