Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vpowf parameters backwards on Intel?



Just out of curiosity, if someone did this:
#if __INTEL__ //<-- I forget the actual macro
#define vpowf(a,b)  vpowf(b,a)
#endif

Would their app break when Apple revved the OS?


On Apr 24, 2006, at 1:50 PM, Ian Ollmann wrote:


This is a known problem that we intend to fix. <rdar://problem/ 4485735>


In certain cases, you might be able to use the vImageGamma functions or vForce instead. Apart from that, I'm not sure that there are any very good workarounds at the moment.

Ian



On Apr 24, 2006, at 12:23 PM, glenn andreas wrote:

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

_______________________________________________
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/jstiles% 40blizzard.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. PerfOptimization-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >vpowf parameters backwards on Intel? (From: glenn andreas <email@hidden>)
 >Re: vpowf parameters backwards on Intel? (From: Ian Ollmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.