I've got an app that is vectorized, and I'm getting different
results between Altivec/PPC and SSE/Intel builds. I've narrowed it
down to a call to vpowf (as found in vecLib/vfp.h).
So if you take the following code:
#include <vecLib/vecLib.h>
#include <stdio.h>
int main(int argc, const char *argv[])
{
#ifdef __VEC__
vFloat two = (vFloat)(2.0,2.0,2.0,2.0);
vFloat oneHalf = (vFloat)(0.5,0.5,0.5,0.5);
#else
vFloat two = (vFloat){2.0,2.0,2.0,2.0};
vFloat oneHalf = (vFloat){0.5,0.5,0.5,0.5};
#endif
vFloat sqrtTwo = vpowf(two, oneHalf);
printf("%vf ^ %vf = %vf\n",two, oneHalf, sqrtTwo);
return 0;
}
compile and run on PPC:
gandreas% gcc -faltivec -framework vecLib -o vpowfppc -isysroot /
Developer/SDKs/MacOSX10.4u.sdk vpowf.c
gandreas% ./vpowfppc
2.000000 2.000000 2.000000 2.000000 ^ 0.500000 0.500000 0.500000
0.500000 = 1.414214 1.414214 1.414214 1.414214
Doing the same for i386:
gandreas% gcc -arch i386 -framework vecLib -o vpowf386 -isysroot /
Developer/SDKs/MacOSX10.4u.sdk vpowf.c
gandreas% ./vpowfi386
2.000000 2.000000 2.000000 2.000000 ^ 0.500000 0.500000 0.500000
0.500000 = 0.250000 0.250000 0.250000 0.250000
Looks like the parameters are backwards to me...
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | build, mutate, evolve | images, textures, backgrounds, art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (PerfOptimization-
email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/iano%
40apple.com
This email sent to email@hidden