Design 
  Community 
  Quesa 3D 
  Discussion
 
 

Message - Re: [Quesa-develop] Re: Quesa - Optimization ideas.

Post a Response | Quesa 3D Forum | Quesa Home | 3D CAD Forum
   

Posted by  Edward K. Chew on February 12, 2004 at 08:09:51:


On Feb 10, 2004, at 16:44, Seth Willits wrote:

> What about __fsqrt? Brian used it in all of his code. I'm assuming it
> was because it was/is faster than sqrt.

I think __fsqrt is only implemented on the G5 (PPC970), am I right?
Also, I am not sure it is supported by all development environments
yet. Does anyone know if CodeWarrior 9 has it? I heard it has yet to
be tuned for the G5, which is why I am not in a hurry to upgrade from
8.3.

It would be great to use __fsqrt, but presumably you would then need
two version of the Quesa library: one for the G5 and one for pre-G5s.
For the latter, __frsqrte has been around since the PPC603. FWIW, I
wrote a function like this and it speeded up my code quite a bit:

float mysqrtf(float x) {
float y;
if(x == 0.0f) y = 0.0f;
else {
const float k = 1.5f;
const float halfx = 0.5f * x;
y = __frsqrte(x);
y *= k - halfx * y * y;
y *= k - halfx * y * y; // add 2 more iterations for double
y *= x;
}
return y;
}

If you need a whole batch of single-precision square roots, I would
recommend vec_rsqrte as an alternative to __frsqrte. Not only does
altivec crunch four at a time, but vec_rsqrte gives you 20 bits of
precision (compared to only 5 for __frsqrte), meaning you can generally
get away with only one iterative refinement.

-Ted

 


Responses:




Post a Response -

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

Quesa 3D Forum | 3D CAD Forum | User Gallery | Architecture Forum | Scrapbook | Green Design
 

DesignCommunity | Quesa Home | ArchWeek | Great Buildings | DesignWorkshop | Free 3D | CAD Outpost | Search
This document is provided for on-line viewing only. http://quesa.DesignCommunity.com/quesa_forum/5329.html