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

quick question about assembler instructions

DSP related issues, mathematics, processing and techniques

quick question about assembler instructions

Postby KG_is_back » Fri Nov 14, 2014 7:10 pm

Hi people, I'm currently creating updated version of assembler opcode reference that contains descriptions (with only FS related info) and CPU costs of all instructions supported by FS assembler. It takes forever to gather data and test it if it works in expected way, so I want to ask few questions about some instructions I'm not sure about.
First of all did you ever used these instructions?:
Code: Select all
inc [reg];
rdtsc;
call reg;
ret;

Are they working? How if yes, why not if not?
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: quick question about assembler instructions

Postby Exo » Fri Nov 14, 2014 10:33 pm

I have never used them, but rdtsc can be read like so....

Code: Select all
streamout read;
rdtsc ; //read time stamp
mov read[0], eax; //probably should be read as an int


AFAIA it can be used to time the speed of opcodes and sections of code but it never used these days because it is unreliable on modern processors. And in Flowstone it is practically useless anyway because it would be called per sample unless you use a jmp.
I found THIS on rdtsc.

inc I have never done anything with, but it looks like it can only take a pointer (address) and then increments the value at the address, just tried it but got a crash.

call and ret no idea how they could be successfully used.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: quick question about assembler instructions

Postby KG_is_back » Fri Nov 14, 2014 11:07 pm

I've done some testing and confirm what you just wrote. rdtsc; works but because of code prefetching is pretty much useless. I believe the stock analyzer prim uses it to count cycles, which would also explain why it's so unreliable and inconsistent.
the inc [reg]; also works but it's actually slower (or at least less efficient in the bigger picture) than mov eax,var; add eax,1; mov var,eax; on modern CPUs according to several optimization guides. I have once successfully implemented jnz integer; by reading the machine code and estimating eip difference from that. Call didn't work even that way though. They are probably there just because they are internally used by multiple primitives. For example when you display assembly output of analyzer you can see the stages end with ret; so FS calls the sample calculations by the "call" probably.
Still I listed them stating they are actually of no use at the moment, just for completeness of the reference.

By the way Exo, any news on possible assembler/code component revision form Malc?
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: quick question about assembler instructions

Postby Exo » Fri Nov 14, 2014 11:23 pm

KG_is_back wrote:They are probably there just because they are internally used by multiple primitives. For example when you display assembly output of analyzer you can see the stages end with ret; so FS calls the sample calculations by the "call" probably.
Still I listed them stating they are actually of no use at the moment, just for completeness of the reference.

Yes I think they are only there because Flowstone is using them but they are of no real use to us, at least with the current feature set.

KG_is_back wrote:By the way Exo, any news on possible assembler/code component revision form Malc?

Sorry not been in touch yet, I will do that this weekend.

Anything else you want me to mention or ask for?

I plan to ask for a few more ASM opcodes, just the ones from the other thread. Let me know if there are others that would be useful.
I will ask him to give some serious consideration to enabling us to write our own functions, it's possible this wouldn't be so hard to add but I don't know, and it depends if he see enough merit in that but I will try to sell it to him ;)
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: quick question about assembler instructions

Postby KG_is_back » Sat Nov 15, 2014 12:08 am

Exo wrote:
Anything else you want me to mention or ask for?

I plan to ask for a few more ASM opcodes, just the ones from the other thread. Let me know if there are others that would be useful.
I will ask him to give some serious consideration to enabling us to write our own functions, it's possible this wouldn't be so hard to add but I don't know, and it depends if he see enough merit in that but I will try to sell it to him ;)


Not really... Adding a few more integer instructions (so we can subtract and possibly multiply and divide integers) will do the thing for me (and the andps coloring bug). I don't think he will be compliant about the function calling - it can be rather tricky calling functions at sample rate.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia


Return to DSP

Who is online

Users browsing this forum: No registered users and 27 guests