Archived

This topic is now archived and is closed to further replies.

Clock cycles & assembly instructions

This topic is 5503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi people, is there anyone who knows of where you can see how many clock cycles certain instructions or operations take. I''ve looked high and low on the net with no success... Thanks in advance.

Share this post


Link to post
Share on other sites
http://www.sandpile.org/ is a good site for x86 info. That said, tho, if you''re thinking of simply counting cycles to optimize a function in assembler, you obviously never learned about processor pipelining.


Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites
Thanks for the reply, and no, i''m just curious about assembly. I''ve been learning C++ and DX8.1 for a year now and i''m ready to move on to assembly, and you''re right, i''ve no idea what pipelining is, but i will do in a moment.

Share this post


Link to post
Share on other sites
Sneftel is very right. While know the number of clock cycles it *theortically* takes an instruction can be useful as a casual pointer, knowing how the pipeline and cache works is much more important (especially if you want your code to run anywhere near halfway decent on a P4)

Share this post


Link to post
Share on other sites
Knowing the *actual* latency of an instruction is very useful - many x86 ops are much slower than equivalent code (e.g. mov eax, [esi] vs. lodsd, dec ecx/jnz label vs. loop label).
Check out AMD''s excellent optimization guide: Link (Appendix F)

Share this post


Link to post
Share on other sites
quote:
Original post by johndunne
Thanks for the reply, and no, i''m just curious about assembly. I''ve been learning C++ and DX8.1 for a year now and i''m ready to move on to assembly, and you''re right, i''ve no idea what pipelining is, but i will do in a moment.


Executing a bunch of instructions in parallel..Sparc pipe:

|t1 |t2 |t3 |t4 |t5 |t6 |t7
----------------------------------------
fetch |f1 |f2 |f3 | | | |
decode | |d1 |d2 |d3 | | |
mem-ax | | |m1 |m2 |m3 | |
store | | | |s1 |s2 |s3 |

Share this post


Link to post
Share on other sites
Ahhh... Superb, plenty of food for thought! I''m just beginning to learn assembly now so i only vaguely know of pipelining and caching. From what I gather the Athlon XP uses pipeling and caching heavily for performance increase. Another question, i''m about to upgrade my processor from a duron to an Athlon, but which one? I''ll be using it mainly for software development, i''m guessing the XP is the one to go...

Share this post


Link to post
Share on other sites