简体   繁体   中英

Is it correct to say “CMP command is the longest assembly command”?

与其他汇编语句(例如JMP,CALL,MOV,PUSH)(我的意思是更多可用的命令)相比,说CMP需要更多时间运行是正确的吗?

no, MOV by far can take the longest to run because generically speaking it has to hit memory to perform the move (much slower than register access), and can be blocking. CMP on the other hand generically takes literals and registers as arguments in practice and only hits the ALU.

CALL actually does a PUSH and a JUMP so is the second longest. Oh yes, and as mentioned, JMP can flush the pipeline (although an unconditional jump would not).

Bottom line CMP is fast, fast like INC, ADD, or any other simple math calc that more often than not is optimized to use register values and literals, and doesn't do anything more than hit the ALU.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM