- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
While coding in assembly various series expansions of many functions i tried to optimize my code mainly by using rcpps instruction instead of divaps.When performing tests oncode which calculates sine function by taylor series i did a few measurements as explained here :"http://software.intel.com/en-us/forums/showthread.php?t=52482" and the result was between 10-12 cycles per first term of sine expansion(i used 14 terms).
I would like to ask you how can i rewrite this code in order to gain speed of execution improvment.
[bash]movups xmm0,argument movups xmm1,argument mulps xmm1,xmm1 mulps xmm1,xmm0 mov ebx,OFFSET coef movups xmm2,[ebx] rcpps xmm3,xmm2 ;rcpps used instead of divaps mulps xmm1,xmm3 subps xmm0,xmm1[/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so it's 63 ns per iteration or ~ 120 clocks on your CPU, it does't match your previous reports IIRCcalls 1e6 times fastsin() the result in millisecond is 63
if you keep only the polynomial (get rid of the strange domain check) you should begin to see timings nearer than mine
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following trig functions, but I am wondering if there is a faster algorithm that I could implement:
JAVASCRIPT CODE NEW
static const double SINMIN=0.0009999998333333;
static const double COSMIN=0.9999995000000417;
static const double TANMIN=0.0010000003333334;
static const double E=2.718281828459045235360;
static const double PI=3.14159265358979323846;
static const double MINVAL=0.01;
double sin(double ax)
{
double x=aabs(ax);
if (x==MINVAL)
{
switch (quadrant(ax))
{
case 1:
case 2:
return SINMIN;
case 3:
case 4:
return -SINMIN;
}
}
else
return (SINMIN*cos(x-MINVAL)+COSMIN*sin(x-MINVAL));
}
double cos(double x)
{
if (x==MINVAL)
{
switch (quadrant(ax))
{
case 1:
case 4:
return COSMIN;
case 2:
case 3:
return -COSMIN;
}
}
else
return (COSMIN*cos(x-MINVAL)+SINMIN*sin(x-MINVAL));
}
double tan(double x)
{
if (x==MINVAL)
{
switch (quadrant(ax))
{
case 1:
case 3:
return TANMIN;
case 2:
case 4:
return -TANMIN;
}
}
else
return ((TANMIN+tan(x-MINVAL))/(1.0000000000000-(TANMIN*tan(x-MINVAL))));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following trig functions, but I am wondering if there is a faster algorithm that I could implement
Hi!
What mathematical formulas are your functions based on?
Did you use library trigonometric functions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trigonometric functions implemented in the test-case( Post #290 )are based on fundamental trigonometric identities:
sin(A+B) = sin(A)*cos(B) + cos(A)*sin(B)
cos(A-B) = sin(A)*sin(B) + cos(A)*cos(B)
tan((A+B)/2) = ( sin(A) + sin(B) )/ ( cos(A) + cos(B) )
By the way, that methodis used in Digital Signal Processing to generate tables of values forsin, cos and tan ( all based on Linear Interpolation )
forembedded systems with very constrained Read Only Memory (ROM )resources.
I havemy owntest-case and I'll post it later...
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trigonometric functions implemented in the test-case( Post #290 )are based on fundamental trigonometric identities
Yes that's true,but in his post he is looking for the the fastest method for trigoformulas calculation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please take a look at results of my tests in a Post #279:
http://software.intel.com/en-us/forums/showpost.php?p=190992
There are two groups of test results and results inevey setareordered fromthe best to the worst.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iliyapolak wrote:If you or Sergey are missing specific post or attachments, please raise the topic (e.g. here in the forum or by a pm to me). I cannot promise anything but, personally, I was missing an article and a blog and both could be recovered.He/She won't try to do anything to recover these lost posts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page