Difference between movq and movabsq in x86-64

In NASM / Intel syntax, mov r64, 0x… picks a MOV encoding based on the constant. There are four to choose from with immediate operands: 5 byte mov r32, imm32. (zero-extended to fill the 64-bit register like always). AT&T: mov/movl 6+ byte mov r/m32, imm32. only useful for memory destinations. AT&T: mov/movl 7+ byte mov r/m64, sign-extended-imm32. Can store 8 bytes to memory, or set … Read more

Dynamic vs Static instruction count

The dynamic instruction count is the actual number of instructions executed by the CPU for a specific program execution, whereas the static instruction count is the number of instruction the program has. We usually use dynamic instruction count as if for example you have a loop in your program then some instructions get executed more … Read more

Why doesn’t there exists a subi opcode for MIPS?

When you create an instruction set, you’re bound by some constraints, such as the total number of instructions you can create. The MIPS creators realized that there isn’t a need for subi (because you can add a negative number with addi using 2’s complement), and they simply made the decision to forego making that instruction. It may have been … Read more

The difference between cmpl and cmp

According to my understanding cmpl compares unsigned. It does both, in a way. The difference in signed vs. unsigned is here the usage of the jump instructions. For >, there is ja for unsigned and jg for signed (jump if above and jump if greater). For <, there is jb for unsigned and jl for signed (jump if below and jump if less). To be exact, here … Read more