Furthermore, how does the compiler determine the extent to unroll a loop, assuming all operations in the loop are completely independent of other iterations.
Furthermore, how does the compiler determine the extent to unroll a loop, assuming all
Share
For MSVC there is only a vector independence hint: http://msdn.microsoft.com/en-us/library/hh923901.aspx
For many other compilers, like Intel/ibm, there a several pragma hints for optimizing a loop:
There is a thread with MSVC++ people about unroll heuristic: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/d0b225c2-f5b0-4bb9-ac6a-4d4f61f7cb17/
Basically, unroll will increase code size, so it may be limited in Os and O1 modes (modes table)
PS: Pragma looks like preprocessor directive, but it is not. It is a directive for compiler and it it ignored (kept) by preprocessor.