Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Is ASM faster or better than DSP?

DSP related issues, mathematics, processing and techniques

Is ASM faster or better than DSP?

Postby Spogg » Wed Jun 10, 2015 8:36 am

Hi all

Simple question (I hope!). I see that quite a few people create DSP code blocks then convert the compiled code to ASM.
Why? Is it faster, more accurate or what?
When I've done this myself I can't detect any improvement.

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Is ASM faster or better than DSP?

Postby adamszabo » Wed Jun 10, 2015 10:08 am

ASM is the closest code to give instructions to the CPU. The DSP code will anyway be converted into ASM no matter what, but sometimes its not as "smart", and compiles the code with unnecessary instructions. If you learn to write your code from scratch in assembly you can really optimize it well and it will be faster than the DSP code.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Is ASM faster or better than DSP?

Postby Tronic » Wed Jun 10, 2015 10:18 am

Hi Spogg,
the improvement is how you optimize the assembler code.

this is the result of original compiled abs function:
Code: Select all
streamin in;
streamout out;

float smIntVarTemp=0.0;
float smIntVarZero=0;

movaps xmm0,in;
movaps smIntVarTemp,xmm0;
cmpps xmm0,smIntVarZero,6;
andps xmm0,smIntVarTemp;
addps xmm0,xmm0;
subps xmm0,smIntVarTemp;
movaps out,xmm0;


thi is the optimized version:
Code: Select all
streamin in;
streamout out;

int absMask=2147483647;

movaps xmm0,in;
andps xmm0,absMask;
movaps out,xmm0;
Tronic
 
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Is ASM faster or better than DSP?

Postby Spogg » Wed Jun 10, 2015 11:08 am

Ahhh! Thanks for that guys, now I get it. :)
Thanks for the answers.
Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Is ASM faster or better than DSP?

Postby Nubeat7 » Thu Jun 11, 2015 8:29 pm

just in case if someone asks himself where tronic got the original abs code from, just use the "S" output on the DSP module, this is the ASM code version from your DSP code as text, which you can now copy - paste into the ASM moduleand optimize it there..

if you are interested in optimizing your DSP codes and ASM codes you should have a look to KG's great articles on flowstone guru:

http://flowstone.guru/blog/optimizing-d ... component/
http://flowstone.guru/blog/optimizing-c ... assembler/
http://flowstone.guru/blog/advanced-dsp ... tion-tips/
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Is ASM faster or better than DSP?

Postby Spogg » Fri Jun 12, 2015 10:03 am

Many thanks for that Nubeat7. Some great info there.
Cheers
Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England


Return to DSP

Who is online

Users browsing this forum: No registered users and 42 guests