logoalt Hacker News

Someonelast Wednesday at 4:59 PM2 repliesview on HN

> The x86-64 ISA promises execution of instructions in the specified order

It doesn’t, and out-of-order CPUs don’t do that. https://en.wikipedia.org/wiki/Out-of-order_execution: “In this paradigm, a processor executes instructions in an order governed by the availability of input data and execution units, rather than by their original order in a program.”


Replies

flohofwoelast Wednesday at 5:16 PM

Out-of-order execution is an internal optimization, from the outside results are still guaranteed to be available in order - e.g. the instruction stream appears to be executed in order when observing the CPU from the outside.

For instance you don't need to be afraid that an instruction uses garbage inputs just because a previous instruction hadn't finished computing an input value to the instruction. At worst you'll get a pipeline stall if the CPU can't fill the gap with out-of-order executed instructions.

On some CPUs it does get tricky once memory is involved though (on ARM, but not on x86).

show 1 reply
ThrowawayR2last Wednesday at 7:54 PM

I explicitly said ISA for a reason: https://en.wikipedia.org/wiki/Instruction_set_architecture. OoO is not exposed at the ISA level.