jamesnajera said:So if you were to use SIMD then the project would not be processor independent. This is probably why all the PowerPC software will work if you do not have Altivec.
I strongly disagree with that, if you design your code correctly, you can use SIMD/Altivec selectively; and if you can't get one or another, you drop down to a more "portable" code. Here's an example:
(broken c & pseudo-code)
typedef struct {
(void*)runHeavyCalculation;
} np_t;
np_t np;
if compiling/running on intel
determine processor features
np.runHeavyCalculation = runHeavyCalculationSSE, or
np.runHeavyCalculation = runHeavyCalculationSSE2 or
np.runHeavyCalculation = runHeavyCalculationSSE3, or
np.runHeavyCalculation = runHeavyCalculationMMX depending on CPU features
else if compiling/running on ppc
np.runHeavyCalculation = runHeavyCalculationAltiVec;
else
np.runHeavyCalculation = runHeavyCalculationBase;
fi
and in the code you just call
(np.runHeavyCalculation)() and voila! this part of your code is entirely portable!
of course you'll have you code with:
if intel
void runHeavyCalculationMMX() {
...
}
void runHeavyCalculationSSE() {
...
}
void runHeavyCalculationSSE2() {
...
}
void runHeavyCalculationSSE3() {
...
}
else if ppc
void runHeavyCalculationAltiVec() {
...
}
else
void runHeavyCalculationBase() {
...
}
fi