2

I am trying to compile a list of AL instructions that do not affect the EFLAGS register. So far I have:

1) mov 
2) push
3) pop
4) lea
5) inc and dec do not change the CF

I am looking for weird/exceptional cases

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Bruce
  • 33,927
  • 76
  • 174
  • 262
  • 3
    My 8088 book lists the following as not affecting FLAGS: call, cbw, cwd, esc, hlt, in, into, j*, lea, lods, loop*, mov, movs, nop, not, out, pop, push, ret, stos, wait :) – Jim Rhodes Nov 29 '11 at 04:47
  • @Jim: I am surprised to see NOT in that list – Bruce Nov 29 '11 at 04:53
  • 3
    So was I. But I thought you would be more surprised that someone had an 8088 book (copyright 1981) – Jim Rhodes Nov 29 '11 at 05:27
  • 2
    You should just go through your processor manual and read the description of each instruction to see which ones affect flags. ia-32 has hundreds of instructions. It's rather presumptuous to think somebody is going to read through all of them for you. – Raymond Chen Nov 29 '11 at 13:03
  • @Raymond: I don't want to anyone to read through the entire manual. I was only looking for counter-intuitive cases like inc/dec. – Bruce Nov 29 '11 at 15:07

1 Answers1

3

There is the excellent table of all x86 instructions - http://ref.x86asm.net/coder32.html

See its columns modif f, def f, etc.

Abyx
  • 12,345
  • 5
  • 44
  • 76
  • 1
    The least obvious and most notable case is that NOT doesn't affect FLAGS, apparently [a design mistake by Stephen Morse](https://stackoverflow.com/questions/74341777/why-does-bitwise-not-dont-affect-the-zf-bit) when specifying the 8086 ISA. All the other standard ALU instructions that date back to 8086 affect at least some FLAGS, except for LEA which is sort of special. – Peter Cordes Nov 07 '22 at 04:10