I would like to swap two variables. and i would like to do it through the pipeline using a Read After Write hazard to my advantage.

Pipeline:

OPERXXXXXX FetchXXXXX DecodeXXXX ExecuteXXX WriteBkXXX
STORE X, Y ---------- ---------- ---------- ----------
STORE Y, X STORE X, Y ---------- ---------- ----------
---------- STORE Y, X STORE X, Y ---------- ----------
---------- ---------- STORE Y, X STORE X, Y ----------
---------- ---------- ---------- STORE Y, X STORE X, Y
---------- ---------- ---------- ---------- STORE Y, X

how do i go about telling the compiler to do that (and exactly that) without automatic locks and warning flags? can you suggest any literature/keywords?

specs:

  • -> target: modern architectures which support multistation (more than 4) pipelining

  • -> this is not related to any particular 'problem'. just for the sake of science.

current hurdles:

  • if you know how to ignore datahazards, please share.
Edit
Report