summaryrefslogtreecommitdiffstats
path: root/content/zettel/2b1a.md
blob: d80e6367ec45ac1bbd6d1e6ee70c5dda4ef7d84c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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. 179190. doi: [10.1109/CGO.2003.1191544].</span>

</div>

</div>

  [10.1109/CGO.2003.1191544]: https://doi.org/10.1109/CGO.2003.1191544