在好的 Altix 手册(altix_single_cpu_optimization http://wwwuser.gwdg.de/~parallel/parallelrechner/altix_documentation/altix_single_cpu_optimization.pdf)中,我找到了用于优化编译器的编译提示列表
#pragma ivdep // no aliasing
#pragma swp // try to software-pipeline
#pragma noswp // disable software-pipelining
#pragma loop count (NN) // hint for SWP
#pragma distribute point // split this large loop
#pragma unroll (n) // unroll n times
#pragma nounroll // do not unroll
#pragma prefetch a // prefetch array “a”
#pragma noprefetch c // do not prefetch array “c”
哪些编译器支持这些编译指示?什么实现了链接优化(软件流水线是低 ipc 和低寄存器计数处理器的相当困难的优化之一)?
Sun Studio 12 http://docs.oracle.com/cd/E19205-01/819-5265/bjaby/index.html
#pragma nomemorydepend
#pragma no_side_effect (funcs)
#pragma opt N (funcs)
#pragma pipeloop(n) // like swp, m.b. noswp
#pragma rarely_called(funcs)
#pragma unroll (N)
#pragma swp
#pragma noswp
#pragma unroll
#pragma distribute point
#pragma prefetch *arrays*
#pragma loop count
#pragma ivdep
#pragma block_loop
#pragma disjoint
#pragma execution_frequency
#pragma isolated_call
#pragma stream_unroll
#pragma unroll
#pragma unrollandfuse
Open64 http://wiki.open64.net/index.php/Pragmas_Support_in_Open64(带有其他编译器的一堆或链接)
#pragma unroll
#pragma blockable
#pragma prefetch
#pragma ivdep
PGI 9 http://www.math.hkbu.edu.hk/parallel/pgi/doc/pgiws_ug/pgi32u10.htm
#pragma depchk
#pragma opt
#pragma unroll
#pragma vector
MSvs2003 http://msdn.microsoft.com/en-us/library/d9x1s805(VS.71).aspx
#pragma optimize
惠普 http://www.docs.hp.com/en/B3901-90024/ch03s06.html
#pragma if_convert
#pragma rarely_called
#pragma unroll // or unroll factor
克雷http://docs.cray.com/books/004-2179-001/html-004-2179-001/xgaslrwh.html
#pragma _CRI ivdep
#pragma _CRI opt // or noopt
#pragma _CRI novector // novsearch
#pragma _CRI shortloop
#pragma _CRI prefervector
#pragma _CRI split
#pragma _CRI unroll [n]