1.
Please, refer to CW documentation "Power Arch Buid Tools Reference.pdf" page 97: Command-Line Options for Optimization -O+
2.
These are similar options. The only difference is that with -fprefetch-loop-arrays compiler options (dcbt, dcbtst) instructions are utilized by the compiler automatically.
3.
"Using prefetches can have negative effects, because there are costs associated with data prefetch instructions. These include wasting bandwidth, kicking other data out of the cache and causing additional conflict misses, consuming slots for memory instructions, and increasing code size, which can bump useful instructions out of the instruction cache.
Similarly, prefetching data that is already in the cache increases overhead without providing any benefit. Data might already be in the cache if it is in the same cache line as data already prefetched, or if the data has been used recently."
Using both techniques at the same time is not reasonable. Manual optimization could provide an advance but it requires deep knowledge of the processor architecture and the result might be platform dependent. I think, the manual optimization can be used as the last step of the software development and should be only used in critical places based on the performance profile.
To improve portability, it is reasonable to keep optimized code in libraries. For example, memory copy routines are good targets for manual optimization. For example:
https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/87AECE17F0BCB60C002573CA00652450/$file/440...
BTW. The similar optimization are used in CW runtime library __mem.c with the option USE_FAST_MEMCPY.
4.
Cache write-back mode provides the best performance improvement and should be used unless there are specific requirments for target memory (I/O memory, multi-processor coherency...).
Have a great day,
Pavel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------