[PD-dev] d_math.c "break[s] strict-aliasing rules"

Hans-Christoph Steiner hans at eds.org
Thu Apr 19 22:02:22 CEST 2007


On Apr 19, 2007, at 10:18 AM, Tim Blechmann wrote:

> hi miller,
>
> On Wed, 2007-04-18 at 18:13 -0700, Miller Puckette wrote:
>> Well, I measured the difference and didn't see significant speedup  
>> (on an
>> imac recently)... eventually it might make a difference, of  
>> course.  But
>> certain bit-bashing code (the square root thing, but more importantly
>> phasor~ and osc~) runs half again faster than any version I've  
>> been able
>> to write with strict aliasing.
>
> i did some benchmarks of pd's phasor~ code against a straight-forward
> implementation on my pentium-m, when implementing the objects for  
> nova.
> the straight-forward implementation ran about 20 to 30 % faster  
> than the
> pd-style implementation.

Do you still have the code from the straight forward implementation?

> code like sqare root or inverse square root can be coded by just
> utilizing the rsqrtps and sqrtps opcodes, with a 14 bit precision,  
> when
> working on the sse unit ...

14bit precision would leave a lot to be desired in Pd. Are there high  
precision operators?

>> An alternative would be to special-case the offending code  
>> somehow.  This
>> could be part of a larger effort to make the DSP code modular so  
>> that SSE
>> instructions and whatnot could also be "plugged in".  Worth  
>> thinking about...
>
> according to the gcc manual, simple vectorizable operactions, that's
> used for audio processing, can be autovectorized, if (and only if) the
> programmer takes care of both alignment and aliasing issues ...

Is complying with -fstrict-aliasing enough to take care of the  
aliasing issues?

Do you have any examples of handling alignment issues?

.hc

>
> tim
>
> --
> tim at klingt.org    ICQ: 96771783
> http://tim.klingt.org
>
> Life is really simple, but we insist on making it complicated.
>   Confucius



------------------------------------------------------------------------ 
----

There is no way to peace, peace is the way.       -A.J. Muste






More information about the Pd-dev mailing list