Remix.run Logo
bonzini 5 hours ago

OF/CF/AF are always cleared anyway by SUB r,r. So there's absolutely no difference.

themafia an hour ago | parent [-]

The point is OF/CF are sometimes dependent on the inputs for SUB. They never are for XOR.

bonzini 15 minutes ago | parent [-]

Ah, you mean in terms of complexity of the calculation. Thanks for clarifying.

In practice AF and CF can be computed from the carry out vector which is already available, and OF is a single XOR (of the two most significant bits of the carry out vector). The same circuitry works for XOR and SUB if the carry out vector of XOR is simply all zeroes.