A write instruction in x86 have release semantics, and this tutorial says the following about what release semantics mean:
Release semantics prevent memory reordering of the write-release with any read or write operation that precedes it in program order.
So if I have the following instructions:
read_instruction_1
read_instruction_2
write_instruction_1
write_instruction_2 (the above instructions will no be reordered to below this instruction)
read_instruction_3
write_instruction_3
The instructions above write_instruction_2
will not be reordered to below write_instruction_2
.
But what if I have something like this:
read_instruction_1
read_instruction_2
write_instruction_1
a_non_read_or_write_instruction
write_instruction_2 (will a_non_read_or_write_instruction not be reordered to below this instruction?)
read_instruction_3
write_instruction_3
The a_non_read_or_write_instruction
instruction is not a read or write instruction, but I don't want it to be reordered to below write_instruction_2
, will it not be reordered to below write_instruction_2
?