tom fogal wrote:
> [email protected] writes:
> [snip]
>   
>> +#if (defined(PIPE_CC_GCC) && defined(__i386__))
>>     
>
>          ^^^^^^^^^^^^^^^^^
>
> This is basically an #ifdef (__GNUC__), I'm guessing?
>
>   
Yes, however it seems like the rest of the gallium code is using private 
defines for this, so
I'll stick to that.
>> +struct pipe_atomic {
>> +   int32_t count;
>> +};
>>     
> [snip]
>   
>> +static INLINE int32_t
>> +p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t new)
>> +{
>> +   int32_t previous;
>> +
>> +   __asm__ __volatile__("lock; cmpxchgl %k1,%2":"=a"(previous)
>> +                    :"r"(new), "m"(v->count), "0"(old)
>> +                    :"memory");
>> +
>> +   return previous;
>> +}
>>     
>
> If the code is only compiled on gcc anyway, it seems like one could
> apply the atomics primitives provided by the compiler:
>
>     http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Atomic-Builtins.html
>
> That might allow you to remove the __i386__ qualification as well.
>
> (Note that I've never tried these extensions, just an idea.)
>
> -tom
>   
Thanks for the hint!
The code is not only for GCC, but we'll probably have to code up a lot 
of special cases, so this will definitely help.
I'll give it a check.

/Thomas



------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to