Why doesn't mov set the zero flag?

1.1k Views Asked by At

What is the reason why adding a value into a register doesn't alter the zero flag? For example, let's say I have:

mov array(,%rdi,8), %eax

I would need to also do a second operation to check to see if the value moved was zero, something like:

cmp $0, %eax

But what's the rationale behind doing this? Is the circuit much simpler / instruction much faster on just a straight move operation without altering the flags (it wouldn't need to hit the ALU?) or why aren't the flags set?

0

There are 0 best solutions below