在好的Altix手册(altix_single_cpu_optimization http://wwwuser.gwdg.de/~parallel/parallelrechner/altix_documentation/altix_single_cpu_optimization.pdf)中,我找到了优化编译器的pragma提示列表
#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和低reg数处理器的相当硬优化之一)?
答案 0 :(得分:3)
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
HP http://www.docs.hp.com/en/B3901-90024/ch03s06.html
#pragma if_convert
#pragma rarely_called
#pragma unroll // or unroll factor
CRAY 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]