On 03.12.2009 11:17, Keith Whitwell wrote:
> On Wed, 2009-12-02 at 12:46 -0800, Roland Scheidegger wrote:
>> On 02.12.2009 18:33, José Fonseca wrote:
>>> I've seen strict aliasing assumption causing bugs in other gallium
>>> components. It seems endemic to our code.  Unless we actively decidee to
>>> go and chase the strict aliasing bugs now we should add
>>> -fno-strict-aliasing to all our builds.
>> Hmm, actually some of them (in mesa at least) seem to be really
>> unnecessary. Take the COPY_4FV macro for instance. I replaced that in a
>> simple test program (attached) to either just do direct assignment
>> without cast, or use memcpy instead.
> 
> That comment was probably true in 1999 -- but possibly not any longer...
> 
>> The results are actually interesting, the comment says cast is done to
>> avoid going through fp registers, but looking in the assembly (at least
>> with optimization) that doesn't happen anyway, and the generated code is
>> actually nearly identical, but in fact it not only triggers
>> strict-aliasing warnings but doesn't work correctly (when compiled with
>> -O3 or similar parameters invoking -fstrict-aliasing).
> 
> ...
> 
>> Doesn't use 128bit sse moves but looks like an improvement... When using
>> no optimization code certainly gets much less readable and the memcpy
>> version will call glibc memcpy (which itself will still be optimized
>> hence probably faster despite the function call).
>> So I'll kill at least this one and just use _mesa_memcpy there, unless
>> there are good reasons not to. I think pretty much all compilers should
>> have builtin memcpy optimizations.
> 
> I didn't realize COPY_4FV and friends were related to our strict
> aliasing problems -- if that's the case, let's kill or reimplement them
> straight away.
Actually, that was the simplest one, and most other of these macros
don't do this. There's also plenty of warnings in the shader/grammar
code, apart from that there's actually not that many warnings, at least
when not compiling legacy drivers... So I guess getting rid of
strict-aliasing issues is doable for gallium.

Roland

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to