0

Recently I am learning assembly but having hard time understanding it.

There was question whether x86 ALU instructions directly access memory for fetching operands, but I have no idea if it is directly accessing memory or indirectly accessing the memory.

Could you give me the answer or brief explanation about it? Thank you so much !

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
chae yeon
  • 33
  • 6
  • 2
    The ALU itself doesn't access memory; the rest of the CPU runs a load operation and feeds the result to the ALU. If you're talking about a modern x86 that decodes to uops, see https://agner.org/optimize/ for details about how memory-source instructions decode to a load uop and an ALU uop. On old CPUs like 8086, microcode basically did the same thing, but of course wasn't pipelined so couldn't be doing work in parallel on multiple instructions. – Peter Cordes Apr 16 '22 at 07:46
  • Also semi-related [In x64, using "pop \[RAX\]", where is the value temporarily stored?](https://stackoverflow.com/q/58001187) talks about how CPUs handle load+store instructions. (Whether they involve an ALU or not doesn't actually make a difference.) – Peter Cordes Apr 16 '22 at 08:00

0 Answers0