Clock cycles & assembly instructions

Started by
6 comments, last by johndunne 21 years, 5 months ago
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.
I'm all dunne now
Advertisement
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.
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.
I'm all dunne now
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)
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)
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3
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 |
______________________________Only dead fish go with the main-stream.
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...
I'm all dunne now
Thank for the link Jan, that''ll come in handy no doubt!
I'm all dunne now

This topic is closed to new replies.

Advertisement