1

I have an OR opcode with the same source and destination operand (OR EAX, EAX). Is this performed to for example set the zero flag?

I've searched around some, but cant find a good resource for logical operations and the flags they can set (and preferably why)..

Herky86
  • 11
  • 1
  • `or eax, eax` does set the Zero Flag according to whether `eax` is zero, yes. It also unconditionally clears the Carry Flag. `test` may be slightly better though because the processor can tell more easily that `test` doesn't change the register's value. – ecm Mar 15 '21 at 11:33
  • Just read the official description of the instruction in the Intel/AMD reference manual, e.g. https://www.felixcloutier.com/x86/or. "The OF and CF flags are cleared; the SF, ZF, and PF flags are set according to the result. The state of the AF flag is undefined." For the meaning of "set according to the result", see https://stackoverflow.com/questions/40478386/what-does-set-according-to-the-result-mean-in-intels-sdm-manuals. – Nate Eldredge Mar 15 '21 at 20:28

0 Answers0