summaryrefslogtreecommitdiffstats
path: root/content/zettel/2b1a.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/zettel/2b1a.md')
-rw-r--r--content/zettel/2b1a.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/content/zettel/2b1a.md b/content/zettel/2b1a.md
new file mode 100644
index 0000000..d80e636
--- /dev/null
+++ b/content/zettel/2b1a.md
@@ -0,0 +1,37 @@
++++
+title = "Phi-predication"
+author = "Yann Herklotz"
+tags = []
+categories = []
+backlinks = ["2b1d1", "2b1"]
+forwardlinks = ["2b1b"]
+zettelid = "2b1a"
++++
+
+Phi-predication \[1\] is a lightweight predication implementation where
+phi nodes are inserted in optimal positions instead of having predicated
+instructions. This makes it much better for out-of-order processors with
+deep pipelines, as there will be less pipeline stalls. This is because
+the predicate only needs to be evaluated at the time the phi-instruction
+is executed and not when the individual instructions are executed.
+
+For example, if there are two `mov` that are in two separate branches of
+a conditional statement, then the compare can first be executed,
+followed by the two `mov`, and then finally a phi instruction is
+executed which assigns the right value to the register.
+
+<div id="refs" class="references csl-bib-body" markdown="1">
+
+<div id="ref-chuang03_phi" class="csl-entry" markdown="1">
+
+<span class="csl-left-margin">\[1\]
+</span><span class="csl-right-inline">W. Chuang, B. Calder, and J.
+Ferrante, “Phi-predication for light-weight if-conversion,” in
+*International symposium on code generation and optimization, 2003. CGO
+2003.*, Mar. 2003, pp. 179–190. doi: [10.1109/CGO.2003.1191544].</span>
+
+</div>
+
+</div>
+
+ [10.1109/CGO.2003.1191544]: https://doi.org/10.1109/CGO.2003.1191544