Manual Processor Dispatch Example
This example shows multiple optimized functions in a single binary file.
You can use manual processor dispatch to support up to seven different
versions of any one function, targeting up to seven different processors.
// Declaration Here
__declspec(cpu_dispatch(generic, pentium_iii, pentium_4))
void array_sum(int num){
/* do not add any code here, added by compiler */
};
// Both Definitions Here
__declspec(cpu_specific(generic))
void array_sum(int num) {
/* you add your code for scalar x87 floating-point here*/
}
__declspec(cpu_specific(pentium_iii))
void array_sum(int num) {
/* you add your code for SIMD fp with intrinsics or
vector class library here*/
}
__declspec(cpu_specific(pentium_4))
void array_sum(int num) {
/* you add your code for Streaming SIMD Extensions 2
here*/
}
|